var LiveSearch={
searchBoxes:'',
activeRequests:[],
callbacks:[],
addCallback:function(eventName, callback){
if(this.callbacks[eventName]===undefined){
this.callbacks[eventName]=[];
}
return this.callbacks[eventName].push(callback);
},
invokeCallbacks:function(eventName, params){
var callbackIndex;
if(this.callbacks[eventName]!==undefined){
for(callbackIndex in this.callbacks[eventName]){
params=this.callbacks[eventName][callbackIndex](params);
}}
}};
LiveSearch.init=function(){
LiveSearch.searchBoxes=jQuery("input").filter("[name='s']").not('.no-livesearch');
LiveSearch.searchBoxes.keyup(LiveSearch.handleKeypress);
LiveSearch.searchBoxes.focus(LiveSearch.hideResults);
if(!LiveSearch.searchBoxes.outerHeight){
alert(DavesWordPressLiveSearchConfig.outdatedJQuery);
}
LiveSearch.searchBoxes.parents('form').attr('autocomplete', 'off');
LiveSearch.searchBoxes.each(function(){
this.autocomplete='off';
});
jQuery("html").click(LiveSearch.hideResults);
LiveSearch.searchBoxes.click(function(e){e.stopPropagation();});
LiveSearch.compiledResultTemplate=_.template(DavesWordPressLiveSearchConfig.resultTemplate);
jQuery(window).resize(function(){
LiveSearch.positionResults(this);
});
}
LiveSearch.positionResults=function(){
var topOffset;
var searchBox=jQuery('input:focus').first();
var resultsElement=jQuery('#dwls_search_results');
if(resultsElement&&searchBox.length > 0){
var searchBoxPosition=searchBox.offset(),
getStyle=(searchBox.closest('.style-light').length) ? 'style-light':'style-dark',
getBgStyle=(searchBox.closest('.style-light').length) ? 'style-light-bg':'style-dark-bg';
resultsElement.addClass(getBgStyle);
resultsElement.wrap("
");
searchBoxPosition.left +=parseInt(DavesWordPressLiveSearchConfig.xOffset, 10);
searchBoxPosition.top +=searchBox.outerHeight(false) + parseInt(DavesWordPressLiveSearchConfig.yOffset, 10);
searchBoxPosition.top -=parseInt(jQuery('html').css('margin-top'), 10);
searchBoxPosition.top -=parseInt(jQuery('html').css('padding-top'), 10);
resultsElement.css('left', searchBoxPosition.left);
resultsElement.css('top', searchBoxPosition.top);
resultsElement.css('width', jQuery('.search-container-inner').width());
resultsElement.css('display', 'block');
resultsElement.css('top', topOffset + 'px');
}};
LiveSearch.handleAJAXResults=function(e){
var renderedResult='';
LiveSearch.activeRequests.pop();
if(e){
resultsSearchTerm=e.searchTerms;
if(resultsSearchTerm!=jQuery('input:focus').first().val()){
if(LiveSearch.activeRequests.length===0){
LiveSearch.removeIndicator();
}
return;
}
var resultsShownFor=jQuery('#dwls_search_results').children("input[name=query]").val();
if(resultsShownFor!==""&&resultsSearchTerm==resultsShownFor){
if(LiveSearch.activeRequests.length===0){
LiveSearch.removeIndicator();
}
return;
}
if(e.results.length===0){
LiveSearch.hideResults();
}else{
renderedResult=LiveSearch.compiledResultTemplate({
'searchResults': e.results,
'e': e,
'resultsSearchTerm': resultsSearchTerm
});
var existingResultsElement=jQuery('#dwls_search_results');
if(existingResultsElement.length > 0){
jQuery('#dwls_search_results').replaceWith(renderedResult);
}else{
jQuery('body').append(renderedResult);
}
LiveSearch.positionResults();
jQuery('#dwls_search_results').bind('click.dwls', function(){
window.location.href=jQuery(this).find('a.daves-wordpress-live-search_title').attr('href');
});
}
if(LiveSearch.activeRequests.length===0){
LiveSearch.removeIndicator();
}}
};
LiveSearch.handleKeypress=function(e){
var delayTime=0;
var term=LiveSearch.searchBoxes.val();
setTimeout(function(){LiveSearch.runQuery(term);}, delayTime);
};
LiveSearch.runQuery=function(terms){
var searchBox=jQuery('input:focus');
var srch=searchBox.val();
var fieldIndex;
var req;
if(srch!=undefined&&(srch===""||srch.length < DavesWordPressLiveSearchConfig.minCharsToSearch)){
LiveSearch.hideResults();
LiveSearch.removeIndicator();
}else{
LiveSearch.displayIndicator();
while(LiveSearch.activeRequests.length > 0){
req=LiveSearch.activeRequests.pop();
req.abort();
}
var parameters={};
var fields=searchBox.parents('form').find('input:not(:submit),select,textarea');
for(fieldIndex in fields){
if(fields.hasOwnProperty(fieldIndex)&& fieldIndex % 1===0){
var field=jQuery(fields[fieldIndex]);
parameters[field.attr('name')]=field.val();
}}
parameters.action="dwls_search";
req=jQuery.get(DavesWordPressLiveSearchConfig.ajaxURL, parameters, LiveSearch.handleAJAXResults, "json");
req.fail=LiveSearch.ajaxFailHandler;
LiveSearch.activeRequests.push(req);
}};
LiveSearch.ajaxFailHandler=function(data){
console.log("Dave's WordPress Live Search: There was an error retrieving or parsing search results");
console.log("The data returned was:");
console.log(data);
};
LiveSearch.hideResults=function(){
var visibleResults=jQuery("#uncode-search-result");
if(visibleResults.length > 0){
LiveSearch.invokeCallbacks('BeforeHideResults');
switch(DavesWordPressLiveSearchConfig.resultsDirection){
case 'up':
visibleResults.fadeOut('normal', function(){
visibleResults.remove();
LiveSearch.invokeCallbacks('AfterHideResults');
});
break;
case 'down':
visibleResults.slideUp('normal', function(){
visibleResults.remove();
LiveSearch.invokeCallbacks('AfterHideResults');
});
break;
default:
visibleResults.slideUp('normal', function(){
visibleResults.remove();
LiveSearch.invokeCallbacks('AfterHideResults');
});
}}
};
LiveSearch.displayIndicator=function(){
if(jQuery(".search_results_activity_indicator").length===0){
var searchBox=jQuery('.uncode-live-search input');
var searchBoxPosition=searchBox.offset();
jQuery('.uncode-live-search i').css('opacity',0);
if(searchBoxPosition!=undefined){
var getStyle=(searchBox.closest('.style-light').length) ? 'style-light':'style-dark';
jQuery("body").append(' ');
jQuery(".search_results_activity_indicator").css('position', 'absolute').css('z-index', 9999);
var getAdminBar=parseInt(jQuery('html').css('margin-top'), 10);
getAdminBar +=parseInt(jQuery('html').css('padding-top'), 10);
var indicatorY=(searchBoxPosition.top + ((searchBox.outerHeight() - searchBox.innerHeight()) / 2) + 12 - getAdminBar + 'px');
jQuery(".search_results_activity_indicator").css('top', indicatorY);
var indicatorX=(searchBoxPosition.left + searchBox.outerWidth() - (jQuery(".search_results_activity_indicator").width())) - 20 + 'px';
jQuery(".search_results_activity_indicator").css('left', indicatorX);
}}
};
LiveSearch.removeIndicator=function(){
jQuery('.uncode-live-search i').css('opacity',1);
jQuery(".search_results_activity_indicator").remove();
};
jQuery(function(){
LiveSearch.init();
});
(function($){
'use strict';
if(typeof wpcf7==='undefined'||wpcf7===null){
return;
}
wpcf7=$.extend({
cached: 0,
inputs: []
}, wpcf7);
$(function(){
wpcf7.supportHtml5=(function(){
var features={};
var input=document.createElement('input');
features.placeholder='placeholder' in input;
var inputTypes=[ 'email', 'url', 'tel', 'number', 'range', 'date' ];
$.each(inputTypes, function(index, value){
input.setAttribute('type', value);
features[ value ]=input.type!=='text';
});
return features;
})();
$('div.wpcf7 > form').each(function(){
var $form=$(this);
wpcf7.initForm($form);
if(wpcf7.cached){
wpcf7.refill($form);
}});
});
wpcf7.getId=function(form){
return parseInt($('input[name="_wpcf7"]', form).val(), 10);
};
wpcf7.initForm=function(form){
var $form=$(form);
$form.submit(function(event){
if(! wpcf7.supportHtml5.placeholder){
$('[placeholder].placeheld', $form).each(function(i, n){
$(n).val('').removeClass('placeheld');
});
}
if(typeof window.FormData==='function'){
wpcf7.submit($form);
event.preventDefault();
}});
$('.wpcf7-submit', $form).after(' ');
wpcf7.toggleSubmit($form);
$form.on('click', '.wpcf7-acceptance', function(){
wpcf7.toggleSubmit($form);
});
$('.wpcf7-exclusive-checkbox', $form).on('click', 'input:checkbox', function(){
var name=$(this).attr('name');
$form.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false);
});
$('.wpcf7-list-item.has-free-text', $form).each(function(){
var $freetext=$(':input.wpcf7-free-text', this);
var $wrap=$(this).closest('.wpcf7-form-control');
if($(':checkbox, :radio', this).is(':checked')){
$freetext.prop('disabled', false);
}else{
$freetext.prop('disabled', true);
}
$wrap.on('change', ':checkbox, :radio', function(){
var $cb=$('.has-free-text', $wrap).find(':checkbox, :radio');
if($cb.is(':checked')){
$freetext.prop('disabled', false).focus();
}else{
$freetext.prop('disabled', true);
}});
});
if(! wpcf7.supportHtml5.placeholder){
$('[placeholder]', $form).each(function(){
$(this).val($(this).attr('placeholder'));
$(this).addClass('placeheld');
$(this).focus(function(){
if($(this).hasClass('placeheld')){
$(this).val('').removeClass('placeheld');
}});
$(this).blur(function(){
if(''===$(this).val()){
$(this).val($(this).attr('placeholder'));
$(this).addClass('placeheld');
}});
});
}
if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.date){
$form.find('input.wpcf7-date[type="date"]').each(function(){
$(this).datepicker({
dateFormat: 'yy-mm-dd',
minDate: new Date($(this).attr('min')),
maxDate: new Date($(this).attr('max'))
});
});
}
if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.number){
$form.find('input.wpcf7-number[type="number"]').each(function(){
$(this).spinner({
min: $(this).attr('min'),
max: $(this).attr('max'),
step: $(this).attr('step')
});
});
}
wpcf7.resetCounter($form);
$form.on('change', '.wpcf7-validates-as-url', function(){
var val=$.trim($(this).val());
if(val
&& ! val.match(/^[a-z][a-z0-9.+-]*:/i)
&& -1!==val.indexOf('.')){
val=val.replace(/^\/+/, '');
val='http://' + val;
}
$(this).val(val);
});
};
wpcf7.submit=function(form){
if(typeof window.FormData!=='function'){
return;
}
var $form=$(form);
$('.ajax-loader', $form).addClass('is-active');
wpcf7.clearResponse($form);
var formData=new FormData($form.get(0));
var detail={
id: $form.closest('div.wpcf7').attr('id'),
status: 'init',
inputs: [],
formData: formData
};
$.each($form.serializeArray(), function(i, field){
if('_wpcf7'==field.name){
detail.contactFormId=field.value;
}else if('_wpcf7_version'==field.name){
detail.pluginVersion=field.value;
}else if('_wpcf7_locale'==field.name){
detail.contactFormLocale=field.value;
}else if('_wpcf7_unit_tag'==field.name){
detail.unitTag=field.value;
}else if('_wpcf7_container_post'==field.name){
detail.containerPostId=field.value;
}else if(field.name.match(/^_wpcf7_\w+_free_text_/)){
var owner=field.name.replace(/^_wpcf7_\w+_free_text_/, '');
detail.inputs.push({
name: owner + '-free-text',
value: field.value
});
}else if(field.name.match(/^_/)){
}else{
detail.inputs.push(field);
}});
wpcf7.triggerEvent($form.closest('div.wpcf7'), 'beforesubmit', detail);
var ajaxSuccess=function(data, status, xhr, $form){
detail.id=$(data.into).attr('id');
detail.status=data.status;
detail.apiResponse=data;
var $message=$('.wpcf7-response-output', $form);
switch(data.status){
case 'validation_failed':
$.each(data.invalidFields, function(i, n){
$(n.into, $form).each(function(){
wpcf7.notValidTip(this, n.message);
$('.wpcf7-form-control', this).addClass('wpcf7-not-valid');
$('[aria-invalid]', this).attr('aria-invalid', 'true');
});
});
$message.addClass('wpcf7-validation-errors');
$form.addClass('invalid');
wpcf7.triggerEvent(data.into, 'invalid', detail);
break;
case 'acceptance_missing':
$message.addClass('wpcf7-acceptance-missing');
$form.addClass('unaccepted');
wpcf7.triggerEvent(data.into, 'unaccepted', detail);
break;
case 'spam':
$message.addClass('wpcf7-spam-blocked');
$form.addClass('spam');
wpcf7.triggerEvent(data.into, 'spam', detail);
break;
case 'aborted':
$message.addClass('wpcf7-aborted');
$form.addClass('aborted');
wpcf7.triggerEvent(data.into, 'aborted', detail);
break;
case 'mail_sent':
$message.addClass('wpcf7-mail-sent-ok');
$form.addClass('sent');
wpcf7.triggerEvent(data.into, 'mailsent', detail);
break;
case 'mail_failed':
$message.addClass('wpcf7-mail-sent-ng');
$form.addClass('failed');
wpcf7.triggerEvent(data.into, 'mailfailed', detail);
break;
default:
var customStatusClass='custom-'
+ data.status.replace(/[^0-9a-z]+/i, '-');
$message.addClass('wpcf7-' + customStatusClass);
$form.addClass(customStatusClass);
}
wpcf7.refill($form, data);
wpcf7.triggerEvent(data.into, 'submit', detail);
if('mail_sent'==data.status){
$form.each(function(){
this.reset();
});
wpcf7.toggleSubmit($form);
wpcf7.resetCounter($form);
}
if(! wpcf7.supportHtml5.placeholder){
$form.find('[placeholder].placeheld').each(function(i, n){
$(n).val($(n).attr('placeholder'));
});
}
$message.html('').append(data.message).slideDown('fast');
$message.attr('role', 'alert');
$('.screen-reader-response', $form.closest('.wpcf7')).each(function(){
var $response=$(this);
$response.html('').attr('role', '').append(data.message);
if(data.invalidFields){
var $invalids=$('');
$.each(data.invalidFields, function(i, n){
if(n.idref){
var $li=$(' ').append($(' ').attr('href', '#' + n.idref).append(n.message));
}else{
var $li=$(' ').append(n.message);
}
$invalids.append($li);
});
$response.append($invalids);
}
$response.attr('role', 'alert').focus();
});
};
$.ajax({
type: 'POST',
url: wpcf7.apiSettings.getRoute('/contact-forms/' + wpcf7.getId($form) + '/feedback'),
data: formData,
dataType: 'json',
processData: false,
contentType: false
}).done(function(data, status, xhr){
ajaxSuccess(data, status, xhr, $form);
$('.ajax-loader', $form).removeClass('is-active');
}).fail(function(xhr, status, error){
var $e=$('
').text(error.message);
$form.after($e);
});
};
wpcf7.triggerEvent=function(target, name, detail){
var $target=$(target);
var event=new CustomEvent('wpcf7' + name, {
bubbles: true,
detail: detail
});
$target.get(0).dispatchEvent(event);
$target.trigger('wpcf7:' + name, detail);
$target.trigger(name + '.wpcf7', detail);
};
wpcf7.toggleSubmit=function(form, state){
var $form=$(form);
var $submit=$('input:submit', $form);
if(typeof state!=='undefined'){
$submit.prop('disabled', ! state);
return;
}
if($form.hasClass('wpcf7-acceptance-as-validation')){
return;
}
$submit.prop('disabled', false);
$('.wpcf7-acceptance', $form).each(function(){
var $span=$(this);
var $input=$('input:checkbox', $span);
if(! $span.hasClass('optional')){
if($span.hasClass('invert')&&$input.is(':checked')
|| ! $span.hasClass('invert')&&! $input.is(':checked')){
$submit.prop('disabled', true);
return false;
}}
});
};
wpcf7.resetCounter=function(form){
var $form=$(form);
$('.wpcf7-character-count', $form).each(function(){
var $count=$(this);
var name=$count.attr('data-target-name');
var down=$count.hasClass('down');
var starting=parseInt($count.attr('data-starting-value'), 10);
var maximum=parseInt($count.attr('data-maximum-value'), 10);
var minimum=parseInt($count.attr('data-minimum-value'), 10);
var updateCount=function(target){
var $target=$(target);
var length=$target.val().length;
var count=down ? starting - length:length;
$count.attr('data-current-value', count);
$count.text(count);
if(maximum&&maximum < length){
$count.addClass('too-long');
}else{
$count.removeClass('too-long');
}
if(minimum&&length < minimum){
$count.addClass('too-short');
}else{
$count.removeClass('too-short');
}};
$(':input[name="' + name + '"]', $form).each(function(){
updateCount(this);
$(this).keyup(function(){
updateCount(this);
});
});
});
};
wpcf7.notValidTip=function(target, message){
var $target=$(target);
$('.wpcf7-not-valid-tip', $target).remove();
$(' ').attr({
'class': 'wpcf7-not-valid-tip',
'role': 'alert',
'aria-hidden': 'true',
}).text(message).appendTo($target);
if($target.is('.use-floating-validation-tip *')){
var fadeOut=function(target){
$(target).not(':hidden').animate({
opacity: 0
}, 'fast', function(){
$(this).css({ 'z-index': -100 });
});
};
$target.on('mouseover', '.wpcf7-not-valid-tip', function(){
fadeOut(this);
});
$target.on('focus', ':input', function(){
fadeOut($('.wpcf7-not-valid-tip', $target));
});
}};
wpcf7.refill=function(form, data){
var $form=$(form);
var refillCaptcha=function($form, items){
$.each(items, function(i, n){
$form.find(':input[name="' + i + '"]').val('');
$form.find('img.wpcf7-captcha-' + i).attr('src', n);
var match=/([0-9]+)\.(png|gif|jpeg)$/.exec(n);
$form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[ 1 ]);
});
};
var refillQuiz=function($form, items){
$.each(items, function(i, n){
$form.find(':input[name="' + i + '"]').val('');
$form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[ 0 ]);
$form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[ 1 ]);
});
};
if(typeof data==='undefined'){
$.ajax({
type: 'GET',
url: wpcf7.apiSettings.getRoute('/contact-forms/' + wpcf7.getId($form) + '/refill'),
beforeSend: function(xhr){
var nonce=$form.find(':input[name="_wpnonce"]').val();
if(nonce){
xhr.setRequestHeader('X-WP-Nonce', nonce);
}},
dataType: 'json'
}).done(function(data, status, xhr){
if(data.captcha){
refillCaptcha($form, data.captcha);
}
if(data.quiz){
refillQuiz($form, data.quiz);
}});
}else{
if(data.captcha){
refillCaptcha($form, data.captcha);
}
if(data.quiz){
refillQuiz($form, data.quiz);
}}
};
wpcf7.clearResponse=function(form){
var $form=$(form);
$form.removeClass('invalid spam sent failed');
$form.siblings('.screen-reader-response').html('').attr('role', '');
$('.wpcf7-not-valid-tip', $form).remove();
$('[aria-invalid]', $form).attr('aria-invalid', 'false');
$('.wpcf7-form-control', $form).removeClass('wpcf7-not-valid');
$('.wpcf7-response-output', $form)
.hide().empty().removeAttr('role')
.removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
};
wpcf7.apiSettings.getRoute=function(path){
var url=wpcf7.apiSettings.root;
url=url.replace(wpcf7.apiSettings.namespace,
wpcf7.apiSettings.namespace + path);
return url;
};})(jQuery);
(function (){
if(typeof window.CustomEvent==="function") return false;
function CustomEvent(event, params){
params=params||{ bubbles: false, cancelable: false, detail: undefined };
var evt=document.createEvent('CustomEvent');
evt.initCustomEvent(event,
params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype=window.Event.prototype;
window.CustomEvent=CustomEvent;
})();
(function(factory){var registeredInModuleLoader=false;if(typeof define==="function"&&define.amd){define(factory);registeredInModuleLoader=true}if(typeof exports==="object"){module.exports=factory();registeredInModuleLoader=true}if(!registeredInModuleLoader){var OldCookies=window.Cookies;var api=window.Cookies=factory();api.noConflict=function(){window.Cookies=OldCookies;return api}}})(function(){function extend(){var i=0;var result={};for(;i1){attributes=extend({path:"/"},api.defaults,attributes);if(typeof attributes.expires==="number"){var expires=new Date;expires.setMilliseconds(expires.getMilliseconds()+attributes.expires*864e5);attributes.expires=expires}attributes.expires=attributes.expires?attributes.expires.toUTCString():"";try{result=JSON.stringify(value);if(/^[\{\[]/.test(result)){value=result}}catch(e){}if(!converter.write){value=encodeURIComponent(String(value)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)}else{value=converter.write(value,key)}key=encodeURIComponent(String(key));key=key.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);key=key.replace(/[\(\)]/g,escape);var stringifiedAttributes="";for(var attributeName in attributes){if(!attributes[attributeName]){continue}stringifiedAttributes+="; "+attributeName;if(attributes[attributeName]===true){continue}stringifiedAttributes+="="+attributes[attributeName]}return document.cookie=key+"="+value+stringifiedAttributes}if(!key){result={}}var cookies=document.cookie?document.cookie.split("; "):[];var rdecode=/(%[0-9A-Z]{2})+/g;var i=0;for(;i-1){return true}}return false};$(function(){if(!Cookies.get("uncode_privacy[privacy_bar]")){$(".gdpr.gdpr-privacy-bar").delay(1e3).slideDown(600)}$(document).on("click",".gdpr.gdpr-privacy-bar .gdpr-agreement",function(){$(".gdpr.gdpr-privacy-bar").addClass("gdpr-hide-bar");Cookies.set("uncode_privacy[privacy_bar]",1,{expires:365})});$(document).on("submit",".gdpr-privacy-preferences-frm",function(){Cookies.set("uncode_privacy[privacy_bar]",1,{expires:365})});$(document).on("click",".gdpr-preferences",function(){var type=$(this).data("type");$(".gdpr-overlay").fadeIn();$("body").addClass("gdpr-noscroll");$(".gdpr.gdpr-privacy-preferences .gdpr-wrapper").fadeIn()});$(document).on("click",".gdpr.gdpr-privacy-preferences .gdpr-close, .gdpr-overlay",function(){$(".gdpr-overlay").fadeOut();$("body").removeClass("gdpr-noscroll");$(".gdpr.gdpr-privacy-preferences .gdpr-wrapper").fadeOut()});$("body").on("click",".gdpr-preferences",function(e){e.preventDefault();$(window).trigger("gdprOpen")}).on("click",".gdpr.gdpr-privacy-preferences .gdpr-close, .gdpr-overlay",function(){$(window).trigger("gdprClose")});var switches=$(".gdpr-switch").find("input");function add_active_color(el){el.next().css("background",Uncode_Privacy_Parameters.accent_color)}function add_default_color(el){el.next().css("background","#ccc")}switches.each(function(){var _this=$(this);if($("body").hasClass("logged-in")){if(_this.prop("checked")){add_active_color(_this)}}_this.on("change",function(){if(_this.prop("checked")){add_active_color(_this)}else{add_default_color(_this)}})});if(!$("body").hasClass("logged-in")){switches.each(function(){var _this=$(this);var type=_this.attr("name")=="user_consents[]"?"consent":"cookie";if(type=="consent"){var is_allowed=uncode_toolkit_privacy_has_consent(_this.val());if(is_allowed){_this.prop("checked",true);add_active_color(_this)}else{_this.prop("checked",false);add_default_color(_this)}}})}var banner_links=$(".gdpr-privacy-bar .gdpr-content").find("a");banner_links.each(function(){add_link_color($(this))});function add_link_color(el){el.css("color",Uncode_Privacy_Parameters.accent_color)}})})(jQuery);
!function r(a,s,l){function d(t,e){if(!s[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var i=s[t]={exports:{}};a[t][0].call(i.exports,function(e){return d(a[t][1][e]||e)},i,i.exports,r,a,s,l)}return s[t].exports}for(var u="function"==typeof require&&require,e=0;e',o.addControlElement(t,"fullscreen"),t.addEventListener("click",function(){m.HAS_TRUE_NATIVE_FULLSCREEN&&m.IS_FULLSCREEN||n.isFullScreen?n.exitFullScreen():n.enterFullScreen()}),n.fullscreenBtn=t,o.options.keyActions.push({keys:[70],action:function(e,t,n,o){o.ctrlKey||void 0!==e.enterFullScreen&&(e.isFullScreen?e.exitFullScreen():e.enterFullScreen())}}),o.exitFullscreenCallback=function(e){var t=e.which||e.keyCode||0;o.options.enableKeyboard&&27===t&&(m.HAS_TRUE_NATIVE_FULLSCREEN&&m.IS_FULLSCREEN||o.isFullScreen)&&n.exitFullScreen()},o.globalBind("keydown",o.exitFullscreenCallback),o.normalHeight=0,o.normalWidth=0,m.HAS_TRUE_NATIVE_FULLSCREEN){n.globalBind(m.FULLSCREEN_EVENT_NAME,function(){n.isFullScreen&&(m.isFullScreen()?(n.isNativeFullScreen=!0,n.setControlsSize()):(n.isNativeFullScreen=!1,n.exitFullScreen()))})}}},cleanfullscreen:function(e){e.exitFullScreen(),e.globalUnbind("keydown",e.exitFullscreenCallback)},detectFullscreenMode:function(){var e=null!==this.media.rendererName&&/(native|html5)/i.test(this.media.rendererName),t="";return m.HAS_TRUE_NATIVE_FULLSCREEN&&e?t="native-native":m.HAS_TRUE_NATIVE_FULLSCREEN&&!e?t="plugin-native":this.usePluginFullScreen&&m.SUPPORT_POINTER_EVENTS&&(t="plugin-click"),this.fullscreenMode=t},enterFullScreen:function(){var o=this,e=null!==o.media.rendererName&&/(html5|native)/i.test(o.media.rendererName),t=getComputedStyle(o.getElement(o.container));if(o.isVideo)if(!1===o.options.useFakeFullscreen&&m.IS_IOS&&m.HAS_IOS_FULLSCREEN&&"function"==typeof o.media.originalNode.webkitEnterFullscreen&&o.media.originalNode.canPlayType((0,y.getTypeFromFile)(o.media.getSrc())))o.media.originalNode.webkitEnterFullscreen();else{if((0,v.addClass)(p.default.documentElement,o.options.classPrefix+"fullscreen"),(0,v.addClass)(o.getElement(o.container),o.options.classPrefix+"container-fullscreen"),o.normalHeight=parseFloat(t.height),o.normalWidth=parseFloat(t.width),"native-native"!==o.fullscreenMode&&"plugin-native"!==o.fullscreenMode||(m.requestFullScreen(o.getElement(o.container)),o.isInIframe&&setTimeout(function e(){if(o.isNativeFullScreen){var t=f.default.innerWidth||p.default.documentElement.clientWidth||p.default.body.clientWidth,n=screen.width;.002*n',l.addEventListener("click",function(){i.paused?i.play():i.pause()});var d=l.querySelector("button");function u(e){"play"===e?((0,m.removeClass)(l,i.options.classPrefix+"play"),(0,m.removeClass)(l,i.options.classPrefix+"replay"),(0,m.addClass)(l,i.options.classPrefix+"pause"),d.setAttribute("title",s),d.setAttribute("aria-label",s)):((0,m.removeClass)(l,i.options.classPrefix+"pause"),(0,m.removeClass)(l,i.options.classPrefix+"replay"),(0,m.addClass)(l,i.options.classPrefix+"play"),d.setAttribute("title",a),d.setAttribute("aria-label",a))}i.addControlElement(l,"playpause"),u("pse"),o.addEventListener("loadedmetadata",function(){-1===o.rendererName.indexOf("flash")&&u("pse")}),o.addEventListener("play",function(){u("play")}),o.addEventListener("playing",function(){u("play")}),o.addEventListener("pause",function(){u("pse")}),o.addEventListener("ended",function(){e.options.loop||((0,m.removeClass)(l,i.options.classPrefix+"pause"),(0,m.removeClass)(l,i.options.classPrefix+"play"),(0,m.addClass)(l,i.options.classPrefix+"replay"),d.setAttribute("title",a),d.setAttribute("aria-label",a))})}})},{18:18,2:2,28:28,29:29,7:7}],13:[function(e,t,n){"use strict";var p=r(e(2)),o=e(18),i=r(o),m=r(e(7)),g=e(27),E=e(32),b=e(28);function r(e){return e&&e.__esModule?e:{default:e}}Object.assign(o.config,{enableProgressTooltip:!0,useSmoothHover:!0,forceLive:!1}),Object.assign(i.default.prototype,{buildprogress:function(h,s,e,d){var u=0,v=!1,c=!1,y=this,t=h.options.autoRewind,n=h.options.enableProgressTooltip?'00:00 ':"",o=p.default.createElement("div");o.className=y.options.classPrefix+"time-rail",o.innerHTML=' '+n+" ",y.addControlElement(o,"progress"),y.options.keyActions.push({keys:[37,227],action:function(e){if(!isNaN(e.duration)&&0o+n.left&&(d=o+n.left),a=(l=d-n.left)/o,y.newTime=a*y.getDuration(),v&&null!==y.getCurrentTime()&&y.newTime.toFixed(4)!==y.getCurrentTime().toFixed(4)&&(y.setCurrentRailHandle(y.newTime),y.updateCurrent(y.newTime)),!g.IS_IOS&&!g.IS_ANDROID){if(l<0&&(l=0),y.options.useSmoothHover&&null!==r&&void 0!==window[r]){var u=new window[r](getComputedStyle(y.handle)[i]).m41,c=l/parseFloat(getComputedStyle(y.total).width)-u/parseFloat(getComputedStyle(y.total).width);y.hovered.style.left=u+"px",y.setTransformStyle(y.hovered,"scaleX("+c+")"),y.hovered.setAttribute("pos",l),0<=c?(0,b.removeClass)(y.hovered,"negative"):(0,b.addClass)(y.hovered,"negative")}if(y.timefloat){var f=y.timefloat.offsetWidth/2,p=mejs.Utils.offset(y.getElement(y.container)),m=getComputedStyle(y.timefloat);s=d-p.left=y.getElement(y.container).offsetWidth-f?y.total.offsetWidth-f:l,(0,b.hasClass)(y.getElement(y.container),y.options.classPrefix+"long-video")&&(s+=parseFloat(m.marginLeft)/2+y.timefloat.offsetWidth/2),y.timefloat.style.left=s+"px",y.timefloatcurrent.innerHTML=(0,E.secondsToTimeCode)(y.newTime,h.options.alwaysShowHours,h.options.showTimecodeFrameCount,h.options.framesPerSecond,h.options.secondsDecimalLength,h.options.timeFormat),y.timefloat.style.display="block"}}}else g.IS_IOS||g.IS_ANDROID||!y.timefloat||(s=y.timefloat.offsetWidth+o>=y.getElement(y.container).offsetWidth?y.timefloat.offsetWidth/2:0,y.timefloat.style.left=s+"px",y.timefloat.style.left=s+"px",y.timefloat.style.display="block")},f=function(){1e3<=new Date-u&&y.play()};y.slider.addEventListener("focus",function(){h.options.autoRewind=!1}),y.slider.addEventListener("blur",function(){h.options.autoRewind=t}),y.slider.addEventListener("keydown",function(e){if(1e3<=new Date-u&&(c=y.paused),y.options.enableKeyboard&&y.options.keyActions.length){var t=e.which||e.keyCode||0,n=y.getDuration(),o=h.options.defaultSeekForwardInterval(d),i=h.options.defaultSeekBackwardInterval(d),r=y.getCurrentTime(),a=y.getElement(y.container).querySelector("."+y.options.classPrefix+"volume-slider");if(38===t||40===t){a&&(a.style.display="block"),y.isVideo&&(y.showControls(),y.startControlsTimer());var s=38===t?Math.min(y.volume+.1,1):Math.max(y.volume-.1,0),l=s<=0;return y.setVolume(s),void y.setMuted(l)}switch(a&&(a.style.display="none"),t){case 37:y.getDuration()!==1/0&&(r-=i);break;case 39:y.getDuration()!==1/0&&(r+=o);break;case 36:r=0;break;case 35:r=n;break;case 13:case 32:return void(g.IS_FIREFOX&&(y.paused?y.play():y.pause()));default:return}r=r<0||isNaN(r)?0:n<=r?n:Math.floor(r),u=new Date,c||h.pause(),r | "}),Object.assign(i.default.prototype,{buildcurrent:function(e,t,n,o){var i=this,r=a.default.createElement("div");r.className=i.options.classPrefix+"time",r.setAttribute("role","timer"),r.setAttribute("aria-live","off"),r.innerHTML=''+(0,s.secondsToTimeCode)(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat)+" ",i.addControlElement(r,"current"),e.updateCurrent(),i.updateTimeCallback=function(){i.controlsAreVisible&&e.updateCurrent()},o.addEventListener("timeupdate",i.updateTimeCallback)},cleancurrent:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateTimeCallback)},buildduration:function(e,t,n,o){var i=this;if(t.lastChild.querySelector("."+i.options.classPrefix+"currenttime"))t.querySelector("."+i.options.classPrefix+"time").innerHTML+=i.options.timeAndDurationSeparator+''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+" ";else{t.querySelector("."+i.options.classPrefix+"currenttime")&&(0,l.addClass)(t.querySelector("."+i.options.classPrefix+"currenttime").parentNode,i.options.classPrefix+"currenttime-container");var r=a.default.createElement("div");r.className=i.options.classPrefix+"time "+i.options.classPrefix+"duration-container",r.innerHTML=''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+" ",i.addControlElement(r,"duration")}i.updateDurationCallback=function(){i.controlsAreVisible&&e.updateDuration()},o.addEventListener("timeupdate",i.updateDurationCallback)},cleanduration:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateDurationCallback)},updateCurrent:function(){var e=this,t=e.getCurrentTime();isNaN(t)&&(t=0);var n=(0,s.secondsToTimeCode)(t,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat);5 ',o.captions.style.display="none",t.insertBefore(o.captions,t.firstChild),o.captionsText=o.captions.querySelector("."+i.options.classPrefix+"captions-text"),o.captionsButton=L.default.createElement("div"),o.captionsButton.className=i.options.classPrefix+"button "+i.options.classPrefix+"captions-button",o.captionsButton.innerHTML=' ",i.addControlElement(o.captionsButton,"tracks"),o.captionsButton.querySelector("."+i.options.classPrefix+"captions-selector-input").disabled=!1,o.chaptersButton=L.default.createElement("div"),o.chaptersButton.className=i.options.classPrefix+"button "+i.options.classPrefix+"chapters-button",o.chaptersButton.innerHTML=' ';for(var u=0,c=0;c'+n+" (loading) "},checkForTracks:function(){var e=this,t=!1;if(e.options.hideCaptionsButtonWhenEmpty){for(var n=0,o=e.tracks.length;n'+e.entries[n].text+" ";for(var o=r.chaptersButton.querySelectorAll('input[type="radio"]'),i=r.chaptersButton.querySelectorAll("."+r.options.classPrefix+"chapters-selector-label"),a=0,s=o.length;a>1].start,a=e[i].stop,r<=t&&t ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(e){for(var t=e.split(/\r?\n/),n=[],o=void 0,i=void 0,r=void 0,a=0,s=t.length;a$1 "),n.push({identifier:r,start:0===(0,m.convertSMPTEtoSeconds)(o[1])?.2:(0,m.convertSMPTEtoSeconds)(o[1]),stop:(0,m.convertSMPTEtoSeconds)(o[3]),text:i,settings:o[5]})}r=""}return n}},dfxp:{parse:function(e){var t=(e=$(e).filter("tt")).firstChild,n=t.querySelectorAll("p"),o=e.getElementById(""+t.attr("style")),i=[],r=void 0;if(o.length){o.removeAttribute("id");var a=o.attributes;if(a.length){r={};for(var s=0,l=a.length;s$1"),i.push(f)}return i}}}},{18:18,2:2,28:28,29:29,32:32,7:7,9:9}],16:[function(e,t,n){"use strict";var w=i(e(2)),x=e(18),o=i(x),T=i(e(7)),P=e(27),C=e(29),k=e(28);function i(e){return e&&e.__esModule?e:{default:e}}Object.assign(x.config,{muteText:null,unmuteText:null,allyVolumeControlText:null,hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical",startVolume:.8}),Object.assign(o.default.prototype,{buildvolume:function(e,t,n,o){if(!P.IS_ANDROID&&!P.IS_IOS||!this.options.hideVolumeOnTouchDevices){var a=this,s=a.isVideo?a.options.videoVolume:a.options.audioVolume,r=(0,C.isString)(a.options.muteText)?a.options.muteText:T.default.t("mejs.mute"),l=(0,C.isString)(a.options.unmuteText)?a.options.unmuteText:T.default.t("mejs.unmute"),i=(0,C.isString)(a.options.allyVolumeControlText)?a.options.allyVolumeControlText:T.default.t("mejs.volume-help-text"),d=w.default.createElement("div");if(d.className=a.options.classPrefix+"button "+a.options.classPrefix+"volume-button "+a.options.classPrefix+"mute",d.innerHTML="horizontal"===s?' ':''+i+' ',a.addControlElement(d,"volume"),a.options.keyActions.push({keys:[38],action:function(e){var t=e.getElement(e.container).querySelector("."+x.config.classPrefix+"volume-slider");t&&t.matches(":focus")&&(t.style.display="block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var n=Math.min(e.volume+.1,1);e.setVolume(n),0'+i+'',d.parentNode.insertBefore(u,d.nextSibling)}var c=!1,f=!1,p=!1,m="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-slider"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-slider"),h="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-total"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-total"),v="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-current"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-current"),y="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-handle"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-handle"),g=function(e){if(null!==e&&!isNaN(e)&&void 0!==e){if(e=Math.max(0,e),0===(e=Math.min(e,1))){(0,k.removeClass)(d,a.options.classPrefix+"mute"),(0,k.addClass)(d,a.options.classPrefix+"unmute");var t=d.firstElementChild;t.setAttribute("title",l),t.setAttribute("aria-label",l)}else{(0,k.removeClass)(d,a.options.classPrefix+"unmute"),(0,k.addClass)(d,a.options.classPrefix+"mute");var n=d.firstElementChild;n.setAttribute("title",r),n.setAttribute("aria-label",r)}var o=100*e+"%",i=getComputedStyle(y);"vertical"===s?(v.style.bottom=0,v.style.height=o,y.style.bottom=o,y.style.marginBottom=-parseFloat(i.height)/2+"px"):(v.style.left=0,v.style.width=o,y.style.left=o,y.style.marginLeft=-parseFloat(i.width)/2+"px")}},E=function(e){var t=(0,k.offset)(h),n=getComputedStyle(h);p=!0;var o=null;if("vertical"===s){var i=parseFloat(n.height);if(o=(i-(e.pageY-t.top))/i,0===t.top||0===t.left)return}else{var r=parseFloat(n.width);o=(e.pageX-t.left)/r}o=Math.max(0,o),o=Math.min(o,1),g(o),a.setMuted(0===o),a.setVolume(o),e.preventDefault(),e.stopPropagation()},b=function(){a.muted?(g(0),(0,k.removeClass)(d,a.options.classPrefix+"mute"),(0,k.addClass)(d,a.options.classPrefix+"unmute")):(g(o.volume),(0,k.removeClass)(d,a.options.classPrefix+"unmute"),(0,k.addClass)(d,a.options.classPrefix+"mute"))};e.getElement(e.container).addEventListener("keydown",function(e){!!e.target.closest("."+a.options.classPrefix+"container")||"vertical"!==s||(m.style.display="none")}),d.addEventListener("mouseenter",function(e){e.target===d&&(m.style.display="block",f=!0,e.preventDefault(),e.stopPropagation())}),d.addEventListener("focusin",function(){m.style.display="block",f=!0}),d.addEventListener("focusout",function(e){e.relatedTarget&&(!e.relatedTarget||e.relatedTarget.matches("."+a.options.classPrefix+"volume-slider"))||"vertical"!==s||(m.style.display="none")}),d.addEventListener("mouseleave",function(){f=!1,c||"vertical"!==s||(m.style.display="none")}),d.addEventListener("focusout",function(){f=!1}),d.addEventListener("keydown",function(e){if(a.options.enableKeyboard&&a.options.keyActions.length){var t=e.which||e.keyCode||0,n=o.volume;switch(t){case 38:n=Math.min(n+.1,1);break;case 40:n=Math.max(0,n-.1);break;default:return!0}c=!1,g(n),o.setVolume(n),e.preventDefault(),e.stopPropagation()}}),d.querySelector("button").addEventListener("click",function(){o.setMuted(!o.muted);var e=(0,C.createEvent)("volumechange",o);o.dispatchEvent(e)}),m.addEventListener("dragstart",function(){return!1}),m.addEventListener("mouseover",function(){f=!0}),m.addEventListener("focusin",function(){m.style.display="block",f=!0}),m.addEventListener("focusout",function(){f=!1,c||"vertical"!==s||(m.style.display="none")}),m.addEventListener("mousedown",function(e){E(e),a.globalBind("mousemove.vol",function(e){var t=e.target;c&&(t===m||t.closest("vertical"===s?"."+a.options.classPrefix+"volume-slider":"."+a.options.classPrefix+"horizontal-volume-slider"))&&E(e)}),a.globalBind("mouseup.vol",function(){c=!1,f||"vertical"!==s||(m.style.display="none")}),c=!0,e.preventDefault(),e.stopPropagation()}),o.addEventListener("volumechange",function(e){var t;c||b(),t=Math.floor(100*o.volume),m.setAttribute("aria-valuenow",t),m.setAttribute("aria-valuetext",t+"%")});var S=!1;o.addEventListener("rendererready",function(){p||setTimeout(function(){S=!0,(0===e.options.startVolume||o.originalNode.muted)&&(o.setMuted(!0),e.options.startVolume=0),o.setVolume(e.options.startVolume),a.setControlsSize()},250)}),o.addEventListener("loadedmetadata",function(){setTimeout(function(){p||S||((0===e.options.startVolume||o.originalNode.muted)&&o.setMuted(!0),o.setVolume(e.options.startVolume),a.setControlsSize()),S=!1},250)}),(0===e.options.startVolume||o.originalNode.muted)&&(o.setMuted(!0),e.options.startVolume=0,b()),a.getElement(a.container).addEventListener("controlsresize",function(){b()})}}})},{18:18,2:2,27:27,28:28,29:29,7:7}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.EN={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.install-flash":"You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/","mejs.fullscreen":"Fullscreen","mejs.play":"Play","mejs.pause":"Pause","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.live-broadcast":"Live Broadcast","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.captions-subtitles":"Captions/Subtitles","mejs.captions-chapters":"Chapters","mejs.none":"None","mejs.afrikaans":"Afrikaans","mejs.albanian":"Albanian","mejs.arabic":"Arabic","mejs.belarusian":"Belarusian","mejs.bulgarian":"Bulgarian","mejs.catalan":"Catalan","mejs.chinese":"Chinese","mejs.chinese-simplified":"Chinese (Simplified)","mejs.chinese-traditional":"Chinese (Traditional)","mejs.croatian":"Croatian","mejs.czech":"Czech","mejs.danish":"Danish","mejs.dutch":"Dutch","mejs.english":"English","mejs.estonian":"Estonian","mejs.filipino":"Filipino","mejs.finnish":"Finnish","mejs.french":"French","mejs.galician":"Galician","mejs.german":"German","mejs.greek":"Greek","mejs.haitian-creole":"Haitian Creole","mejs.hebrew":"Hebrew","mejs.hindi":"Hindi","mejs.hungarian":"Hungarian","mejs.icelandic":"Icelandic","mejs.indonesian":"Indonesian","mejs.irish":"Irish","mejs.italian":"Italian","mejs.japanese":"Japanese","mejs.korean":"Korean","mejs.latvian":"Latvian","mejs.lithuanian":"Lithuanian","mejs.macedonian":"Macedonian","mejs.malay":"Malay","mejs.maltese":"Maltese","mejs.norwegian":"Norwegian","mejs.persian":"Persian","mejs.polish":"Polish","mejs.portuguese":"Portuguese","mejs.romanian":"Romanian","mejs.russian":"Russian","mejs.serbian":"Serbian","mejs.slovak":"Slovak","mejs.slovenian":"Slovenian","mejs.spanish":"Spanish","mejs.swahili":"Swahili","mejs.swedish":"Swedish","mejs.tagalog":"Tagalog","mejs.thai":"Thai","mejs.turkish":"Turkish","mejs.ukrainian":"Ukrainian","mejs.vietnamese":"Vietnamese","mejs.welsh":"Welsh","mejs.yiddish":"Yiddish"}},{}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.config=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function o(e,t){for(var n=0;n
',n.getElement(n.container).addEventListener("focus",function(e){if(!n.controlsAreVisible&&!n.hasFocus&&n.controlsEnabled){n.showControls(!0);var t=(0,E.isNodeAfter)(e.relatedTarget,n.getElement(n.container))?"."+n.options.classPrefix+"controls ."+n.options.classPrefix+"button:last-child > button":"."+n.options.classPrefix+"playpause-button > button";n.getElement(n.container).querySelector(t).focus()}}),n.node.parentNode.insertBefore(n.getElement(n.container),n.node),n.options.features.length||n.options.useDefaultControls||(n.getElement(n.container).style.background="transparent",n.getElement(n.container).querySelector("."+n.options.classPrefix+"controls").style.display="none"),n.isVideo&&"fill"===n.options.stretching&&!T.hasClass(n.getElement(n.container).parentNode,n.options.classPrefix+"fill-container")){n.outerContainer=n.media.parentNode;var r=w.default.createElement("div");r.className=n.options.classPrefix+"fill-container",n.getElement(n.container).parentNode.insertBefore(r,n.getElement(n.container)),r.appendChild(n.getElement(n.container))}if(x.IS_ANDROID&&T.addClass(n.getElement(n.container),n.options.classPrefix+"android"),x.IS_IOS&&T.addClass(n.getElement(n.container),n.options.classPrefix+"ios"),x.IS_IPAD&&T.addClass(n.getElement(n.container),n.options.classPrefix+"ipad"),x.IS_IPHONE&&T.addClass(n.getElement(n.container),n.options.classPrefix+"iphone"),T.addClass(n.getElement(n.container),n.isVideo?n.options.classPrefix+"video":n.options.classPrefix+"audio"),x.IS_SAFARI&&!x.IS_IOS){T.addClass(n.getElement(n.container),n.options.classPrefix+"hide-cues");for(var a=n.node.cloneNode(),s=n.node.children,l=[],d=[],u=0,c=s.length;u=n.width?n.width/n.height:n.height/n.width,n.setPlayerSize(n.width,n.height),e.pluginWidth=n.width,e.pluginHeight=n.height}if(v.default.MepDefaults=e,new y.default(n.media,e,n.mediaFiles),void 0!==n.getElement(n.container)&&n.options.features.length&&n.controlsAreVisible&&!n.options.hideVideoControlsOnLoad){var h=(0,E.createEvent)("controlsshown",n.getElement(n.container));n.getElement(n.container).dispatchEvent(h)}}},{key:"showControls",value:function(e){var i=this;if(e=void 0===e||e,!i.controlsAreVisible&&i.isVideo){if(e)!function(){T.fadeIn(i.getElement(i.controls),200,function(){T.removeClass(i.getElement(i.controls),i.options.classPrefix+"offscreen");var e=(0,E.createEvent)("controlsshown",i.getElement(i.container));i.getElement(i.container).dispatchEvent(e)});for(var n=i.getElement(i.container).querySelectorAll("."+i.options.classPrefix+"control"),e=function(e,t){T.fadeIn(n[e],200,function(){T.removeClass(n[e],i.options.classPrefix+"offscreen")})},t=0,o=n.length;t'),e.message&&(a=""+e.message+"
"),e.urls)for(var d=0,u=e.urls.length;d'+v.default.i18n.t("mejs.download-file")+": "+c.src+" "}}a&&o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error")&&(r.innerHTML=a,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").innerHTML=""+s+r.outerHTML,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").parentNode.style.display="block"),o.controlsEnabled&&o.disableControls()}},{key:"setPlayerSize",value:function(e,t){var n=this;if(!n.options.setDimensions)return!1;switch(void 0!==e&&(n.width=e),void 0!==t&&(n.height=t),n.options.stretching){case"fill":n.isVideo?n.setFillMode():n.setDimensions(n.width,n.height);break;case"responsive":n.setResponsiveMode();break;case"none":n.setDimensions(n.width,n.height);break;default:!0===n.hasFluidMode()?n.setResponsiveMode():n.setDimensions(n.width,n.height)}}},{key:"hasFluidMode",value:function(){var e=this;return-1!==e.height.toString().indexOf("%")||e.node&&e.node.style.maxWidth&&"none"!==e.node.style.maxWidth&&e.node.style.maxWidth!==e.width||e.node&&e.node.currentStyle&&"100%"===e.node.currentStyle.maxWidth}},{key:"setResponsiveMode",value:function(){var e,o=this,t=function(){for(var t=void 0,n=o.getElement(o.container);n;){try{if(x.IS_FIREFOX&&"html"===n.tagName.toLowerCase()&&S.default.self!==S.default.top&&null!==S.default.frameElement)return S.default.frameElement;t=n.parentElement}catch(e){t=n.parentElement}if(t&&T.visible(t))return t;n=t}return null}(),n=t?getComputedStyle(t,null):getComputedStyle(w.default.body,null),i=o.isVideo?o.node.videoWidth&&0=o.width?o.node.videoWidth/o.node.videoHeight:o.node.videoHeight/o.node.videoWidth:o.initialAspectRatio,(isNaN(e)||e<.01||100=o.width?parseFloat(d/a,10):parseFloat(d*a,10):r,isNaN(l)&&(l=s),0img");a&&(a.style.display="");for(var s=e.getElement(e.container).querySelectorAll("object, embed, iframe, video"),l=e.height,d=e.width,u=i,c=l*i/d,f=d*r/l,p=r,m=i ',n.appendChild(r),a.style.display="none",a.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer",a.innerHTML='
',n.appendChild(a),s.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer "+i.options.classPrefix+"overlay-play",s.innerHTML='
',s.addEventListener("click",function(){if(i.options.clickToPlayPause){var e=i.getElement(i.container).querySelector("."+i.options.classPrefix+"overlay-button"),t=e.getAttribute("aria-pressed");i.paused?i.play():i.pause(),e.setAttribute("aria-pressed",!!t),i.getElement(i.container).focus()}}),s.addEventListener("keydown",function(e){var t=e.keyCode||e.which||0;if(13===t||x.IS_FIREFOX&&32===t){var n=(0,E.createEvent)("click",s);return s.dispatchEvent(n),!1}}),n.appendChild(s),null!==i.media.rendererName&&(/(youtube|facebook)/i.test(i.media.rendererName)&&!(i.media.originalNode.getAttribute("poster")||t.options.poster||"function"==typeof i.media.renderer.getPosterUrl&&i.media.renderer.getPosterUrl())||x.IS_STOCK_ANDROID||i.media.originalNode.getAttribute("autoplay"))&&(s.style.display="none");var l=!1;o.addEventListener("play",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("playing",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("seeking",function(){s.style.display="none",r.style.display="",l=!1}),o.addEventListener("seeked",function(){s.style.display=i.paused&&!x.IS_STOCK_ANDROID?"":"none",r.style.display="none",l=!1}),o.addEventListener("pause",function(){r.style.display="none",x.IS_STOCK_ANDROID||l||(s.style.display=""),l=!1}),o.addEventListener("waiting",function(){r.style.display="",l=!1}),o.addEventListener("loadeddata",function(){r.style.display="",x.IS_ANDROID&&(o.canplayTimeout=setTimeout(function(){if(w.default.createEvent){var e=w.default.createEvent("HTMLEvents");return e.initEvent("canplay",!0,!0),o.dispatchEvent(e)}},300)),l=!1}),o.addEventListener("canplay",function(){r.style.display="none",clearTimeout(o.canplayTimeout),l=!1}),o.addEventListener("error",function(e){i._handleError(e,i.media,i.node),r.style.display="none",s.style.display="none",l=!0}),o.addEventListener("loadedmetadata",function(){i.controlsEnabled||i.enableControls()}),o.addEventListener("keydown",function(e){i.onkeydown(t,o,e),l=!1})}}},{key:"buildkeyboard",value:function(o,e,t,i){var r=this;r.getElement(r.container).addEventListener("keydown",function(){r.keyboardAction=!0}),r.globalKeydownCallback=function(e){var t=w.default.activeElement.closest("."+r.options.classPrefix+"container"),n=r.media.closest("."+r.options.classPrefix+"container");return r.hasFocus=!(!t||!n||t.id!==n.id),r.onkeydown(o,i,e)},r.globalClickCallback=function(e){r.hasFocus=!!e.target.closest("."+r.options.classPrefix+"container")},r.globalBind("keydown",r.globalKeydownCallback),r.globalBind("click",r.globalClickCallback)}},{key:"onkeydown",value:function(e,t,n){if(e.hasFocus&&e.options.enableKeyboard)for(var o=0,i=e.options.keyActions.length;oimg");(e&&l.node.setAttribute("poster",e.src),delete l.node.autoplay,l.node.setAttribute("src",""),""!==l.media.canPlayType((0,b.getTypeFromFile)(u))&&l.node.setAttribute("src",u),d&&-1t[0]||n[0]===t[0]&&n[1]>t[1]||n[0]===t[0]&&n[1]===t[1]&&n[2]>=t[2]},addPlugin:function(e,t,n,o,i){r.plugins[e]=r.detectPlugin(t,n,o,i)},detectPlugin:function(e,t,n,o){var i=[0,0,0],r=void 0,a=void 0;if(null!==F.NAV.plugins&&void 0!==F.NAV.plugins&&"object"===d(F.NAV.plugins[e])){if((r=F.NAV.plugins[e].description)&&(void 0===F.NAV.mimeTypes||!F.NAV.mimeTypes[t]||F.NAV.mimeTypes[t].enabledPlugin))for(var s=0,l=(i=r.replace(e,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".")).length;s'+N.default.t("mejs.install-flash")+"
"}else w=['id="__'+r.id+'"','name="__'+r.id+'"','play="true"','loop="false"','quality="high"','bgcolor="#000000"','wmode="transparent"','allowScriptAccess="'+r.options.shimScriptAccess+'"','allowFullScreen="true"','type="application/x-shockwave-flash"','pluginspage="//www.macromedia.com/go/getflashplayer"','src="'+r.options.pluginPath+r.options.filename+'"','flashvars="'+g.join("&")+'"'],E?(w.push('width="'+S+'"'),w.push('height="'+b+'"')):w.push('style="position: fixed; left: -9999em; top: -9999em;"'),r.flashWrapper.innerHTML="";if(r.flashNode=r.flashWrapper.lastChild,r.hide=function(){o=!1,E&&(r.flashNode.style.display="none")},r.show=function(){o=!0,E&&(r.flashNode.style.display="")},r.setSize=function(e,t){r.flashNode.style.width=e+"px",r.flashNode.style.height=t+"px",null!==r.flashApi&&"function"==typeof r.flashApi.fire_setSize&&r.flashApi.fire_setSize(e,t)},r.destroy=function(){r.flashNode.remove()},n&&0":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})}function s(o,i){var r=this,a=arguments,s=2x',t.firstChild.href}function d(e){var t=1'+mejsL10n.strings["mejs.download-file"]+""},n(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").filter(function(){return!n(this).parent().hasClass("mejs-mediaelement")}).mediaelementplayer(e)}}},n(e.wp.mediaelement.initialize)}(window,jQuery);
(function(window, $){
'use strict';
var counter=0,
$headCache=$('head'),
oldBigText=window.BigText,
oldjQueryMethod=$.fn.bigtext,
BigText={
DEBUG_MODE: false,
DEFAULT_MIN_FONT_SIZE_PX: null,
DEFAULT_MAX_FONT_SIZE_PX: 528,
GLOBAL_STYLE_ID: 'bigtext-style',
STYLE_ID: 'bigtext-id',
LINE_CLASS_PREFIX: 'bigtext-line',
EXEMPT_CLASS: 'bigtext-exempt',
noConflict: function(restore){
if(restore){
$.fn.bigtext=oldjQueryMethod;
window.BigText=oldBigText;
}
return BigText;
},
supports: {
wholeNumberFontSizeOnly: (function(){
if(!('getComputedStyle' in window)){
return true;
}
var test=$('
').css({
position: 'absolute',
'font-size': '14.1px'
}).insertBefore($('script').eq(0)),
computedStyle=window.getComputedStyle(test[0], null);
var ret=computedStyle&&computedStyle.getPropertyValue('font-size')==='14px';
test.remove();
return ret;
})()
},
init: function(){
if(!$('#'+BigText.GLOBAL_STYLE_ID).length){
$headCache.append(BigText.generateStyleTag(BigText.GLOBAL_STYLE_ID, ['.bigtext * { white-space: nowrap; } .bigtext > * { display: block; }',
'.bigtext .' + BigText.EXEMPT_CLASS + ', .bigtext .' + BigText.EXEMPT_CLASS + ' * { white-space: normal; }']));
}},
bindResize: function(eventName, resizeFunction){
var timeoutId;
$(window).unbind(eventName).bind(eventName, function(){
if(timeoutId){
clearTimeout(timeoutId);
}
timeoutId=setTimeout(resizeFunction, 300);
});
},
getStyleId: function(id){
return BigText.STYLE_ID + '-' + id;
},
generateStyleTag: function(id, css){
return $('').attr('id', id);
},
clearCss: function(id){
var styleId=BigText.getStyleId(id);
$('#' + styleId).remove();
},
generateCss: function(id, linesFontSizes, lineWordSpacings, minFontSizes){
var css=[];
BigText.clearCss(id);
for(var j=0, k=linesFontSizes.length; j=maxWidth){
$line.css(property, '');
if(width===maxWidth){
return {
match: 'exact',
size: parseFloat((parseFloat(size) - 0.1).toFixed(3))
};}
var under=maxWidth - previousWidth,
over=width - maxWidth;
return {
match: 'estimate',
size: parseFloat((parseFloat(size) - (property==='word-spacing'&&previousWidth&&(over < under) ? 0:interval)).toFixed(3))
};}
return width;
}
function calculateSizes($t, $children, maxWidth, maxFontSize, minFontSize){
var $c=$t.clone(true)
.addClass('bigtext-cloned')
.css({
fontFamily: $t.css('font-family'),
textTransform: $t.css('text-transform'),
wordSpacing: $t.css('word-spacing'),
letterSpacing: $t.css('letter-spacing'),
position: 'absolute',
left: BigText.DEBUG_MODE ? 0:-9999,
top: BigText.DEBUG_MODE ? 0:-9999
})
.appendTo(document.body);
var fontSizes=[],
wordSpacings=[],
minFontSizes=[],
ratios=[];
$children.css('float', 'left').each(function(){
var $line=$(this),
intervals=BigText.supports.wholeNumberFontSizeOnly ? [8, 4, 1]:[8, 4, 1, 0.1],
lineMax,
newFontSize;
if($line.hasClass(BigText.EXEMPT_CLASS)){
fontSizes.push(null);
ratios.push(null);
minFontSizes.push(false);
return;
}
var autoGuessSubtraction=32,
currentFontSize=parseFloat($line.css('font-size')),
ratio=($line.width() / currentFontSize).toFixed(6);
newFontSize=parseInt(maxWidth / ratio, 10) - autoGuessSubtraction;
outer: for(var m=0, n=intervals.length; m maxFontSize){
newFontSize=maxFontSize;
break outer;
}
lineMax=testLineDimensions($line, maxWidth, 'font-size', newFontSize + j*intervals[m], intervals[m], 'px', lineMax);
if(typeof lineMax!=='number'){
newFontSize=lineMax.size;
if(lineMax.match==='exact'){
break outer;
}
break inner;
}}
}
ratios.push(maxWidth / newFontSize);
if(newFontSize > maxFontSize){
fontSizes.push(maxFontSize);
minFontSizes.push(false);
}else if(!!minFontSize&&newFontSize < minFontSize){
fontSizes.push(minFontSize);
minFontSizes.push(true);
}else{
fontSizes.push(newFontSize);
minFontSizes.push(false);
}}).each(function(lineNumber){
var $line=$(this),
wordSpacing=0,
interval=1,
maxWordSpacing;
if($line.hasClass(BigText.EXEMPT_CLASS)){
wordSpacings.push(null);
return;
}
$line.css('font-size', fontSizes[lineNumber] + 'px');
for(var m=1, n=3; m containerWidth){
this.x=0;
this.y=this.maxY;
}
var position={
x: this.x,
y: this.y
};
this.maxY=Math.max(this.maxY, this.y + item.size.outerHeight);
this.x +=itemWidth;
return position;
};
FitRows.prototype._getContainerSize=function(){
return { height: this.maxY };};
return FitRows;
}));
(function(window, factory){
'use strict';
if(typeof define=='function'&&define.amd){
define('isotope/js/layout-modes/vertical',[
'../layout-mode'
],
factory);
}else if(typeof exports=='object'){
module.exports=factory(
require('../layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var Vertical=LayoutMode.create('vertical', {
horizontalAlignment: 0
});
Vertical.prototype._resetLayout=function(){
this.y=0;
};
Vertical.prototype._getItemLayoutPosition=function(item){
item.getSize();
var x=(this.isotope.size.innerWidth - item.size.outerWidth) *
this.options.horizontalAlignment;
var y=this.y;
this.y +=item.size.outerHeight;
return { x: x, y: y };};
Vertical.prototype._getContainerSize=function(){
return { height: this.y };};
return Vertical;
}));
(function(window, factory){
'use strict';
if(typeof define=='function'&&define.amd){
define([
'outlayer/outlayer',
'get-size/get-size',
'matches-selector/matches-selector',
'fizzy-ui-utils/utils',
'isotope/js/item',
'isotope/js/layout-mode',
'isotope/js/layout-modes/masonry',
'isotope/js/layout-modes/fit-rows',
'isotope/js/layout-modes/vertical'
],
function(Outlayer, getSize, matchesSelector, utils, Item, LayoutMode){
return factory(window, Outlayer, getSize, matchesSelector, utils, Item, LayoutMode);
});
}else if(typeof exports=='object'){
module.exports=factory(
window,
require('outlayer'),
require('get-size'),
require('desandro-matches-selector'),
require('fizzy-ui-utils'),
require('./item'),
require('./layout-mode'),
require('./layout-modes/masonry'),
require('./layout-modes/fit-rows'),
require('./layout-modes/vertical')
);
}else{
window.Isotope=factory(
window,
window.Outlayer,
window.getSize,
window.matchesSelector,
window.fizzyUIUtils,
window.Isotope.Item,
window.Isotope.LayoutMode
);
}}(window, function factory(window, Outlayer, getSize, matchesSelector, utils,
Item, LayoutMode){
var jQuery=window.jQuery;
var trim=String.prototype.trim ?
function(str){
return str.trim();
} :
function(str){
return str.replace(/^\s+|\s+$/g, '');
};
var docElem=document.documentElement;
var getText=docElem.textContent ?
function(elem){
return elem.textContent;
} :
function(elem){
return elem.innerText;
};
var Isotope=Outlayer.create('isotope', {
layoutMode: "masonry",
isJQueryFiltering: true,
sortAscending: true
});
Isotope.Item=Item;
Isotope.LayoutMode=LayoutMode;
Isotope.prototype._create=function(){
this.itemGUID=0;
this._sorters={};
this._getSorters();
Outlayer.prototype._create.call(this);
this.modes={};
this.filteredItems=this.items;
this.sortHistory=[ 'original-order' ];
for(var name in LayoutMode.modes){
this._initLayoutMode(name);
}};
Isotope.prototype.reloadItems=function(){
this.itemGUID=0;
Outlayer.prototype.reloadItems.call(this);
};
Isotope.prototype._itemize=function(){
var items=Outlayer.prototype._itemize.apply(this, arguments);
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
item.id=this.itemGUID++;
}
this._updateItemsSortData(items);
return items;
};
Isotope.prototype._initLayoutMode=function(name){
var Mode=LayoutMode.modes[ name ];
var initialOpts=this.options[ name ]||{};
this.options[ name ]=Mode.options ?
utils.extend(Mode.options, initialOpts):initialOpts;
this.modes[ name ]=new Mode(this);
};
Isotope.prototype.layout=function(){
if(!this._isLayoutInited&&this.options.isInitLayout){
this.arrange();
return;
}
this._layout();
};
Isotope.prototype._layout=function(){
var isInstant=this._getIsInstant();
this._resetLayout();
this._manageStamps();
this.layoutItems(this.filteredItems, isInstant);
this._isLayoutInited=true;
};
Isotope.prototype.arrange=function(opts){
this.option(opts);
this._getIsInstant();
var filtered=this._filter(this.items);
this.filteredItems=filtered.matches;
var _this=this;
function hideReveal(){
_this.reveal(filtered.needReveal);
_this.hide(filtered.needHide);
}
this._bindArrangeComplete();
if(this._isInstant){
this._noTransition(hideReveal);
}else{
hideReveal();
}
this._sort();
this._layout();
};
Isotope.prototype._init=Isotope.prototype.arrange;
Isotope.prototype._getIsInstant=function(){
var isInstant=this.options.isLayoutInstant!==undefined ?
this.options.isLayoutInstant:!this._isLayoutInited;
this._isInstant=isInstant;
return isInstant;
};
Isotope.prototype._bindArrangeComplete=function(){
var isLayoutComplete, isHideComplete, isRevealComplete;
var _this=this;
function arrangeParallelCallback(){
if(isLayoutComplete&&isHideComplete&&isRevealComplete){
_this.dispatchEvent('arrangeComplete', null, [ _this.filteredItems ]);
}}
this.once('layoutComplete', function(){
isLayoutComplete=true;
arrangeParallelCallback();
});
this.once('hideComplete', function(){
isHideComplete=true;
arrangeParallelCallback();
});
this.once('revealComplete', function(){
isRevealComplete=true;
arrangeParallelCallback();
});
};
Isotope.prototype._filter=function(items){
var filter=this.options.filter;
filter=filter||'*';
var matches=[];
var hiddenMatched=[];
var visibleUnmatched=[];
var test=this._getFilterTest(filter);
for(var i=0, len=items.length; i < len; i++){
var item=items[i];
if(item.isIgnored){
continue;
}
var isMatched=test(item);
if(isMatched){
matches.push(item);
}
if(isMatched&&item.isHidden){
hiddenMatched.push(item);
}else if(!isMatched&&!item.isHidden){
visibleUnmatched.push(item);
}}
return {
matches: matches,
needReveal: hiddenMatched,
needHide: visibleUnmatched
};};
Isotope.prototype._getFilterTest=function(filter){
if(jQuery&&this.options.isJQueryFiltering){
return function(item){
return jQuery(item.element).is(filter);
};}
if(typeof filter=='function'){
return function(item){
return filter(item.element);
};}
return function(item){
return matchesSelector(item.element, filter);
};};
Isotope.prototype.updateSortData=function(elems){
var items;
if(elems){
elems=utils.makeArray(elems);
items=this.getItems(elems);
}else{
items=this.items;
}
this._getSorters();
this._updateItemsSortData(items);
};
Isotope.prototype._getSorters=function(){
var getSortData=this.options.getSortData;
for(var key in getSortData){
var sorter=getSortData[ key ];
this._sorters[ key ]=mungeSorter(sorter);
}};
Isotope.prototype._updateItemsSortData=function(items){
var len=items&&items.length;
for(var i=0; len&&i < len; i++){
var item=items[i];
item.updateSortData();
}};
var mungeSorter=(function(){
function mungeSorter(sorter){
if(typeof sorter!='string'){
return sorter;
}
var args=trim(sorter).split(' ');
var query=args[0];
var attrMatch=query.match(/^\[(.+)\]$/);
var attr=attrMatch&&attrMatch[1];
var getValue=getValueGetter(attr, query);
var parser=Isotope.sortDataParsers[ args[1] ];
sorter=parser ? function(elem){
return elem&&parser(getValue(elem));
} :
function(elem){
return elem&&getValue(elem);
};
return sorter;
}
function getValueGetter(attr, query){
var getValue;
if(attr){
getValue=function(elem){
return elem.getAttribute(attr);
};}else{
getValue=function(elem){
var child=elem.querySelector(query);
return child&&getText(child);
};}
return getValue;
}
return mungeSorter;
})();
Isotope.sortDataParsers={
'parseInt': function(val){
return parseInt(val, 10);
},
'parseFloat': function(val){
return parseFloat(val);
}};
Isotope.prototype._sort=function(){
var sortByOpt=this.options.sortBy;
if(!sortByOpt){
return;
}
var sortBys=[].concat.apply(sortByOpt, this.sortHistory);
var itemSorter=getItemSorter(sortBys, this.options.sortAscending);
this.filteredItems.sort(itemSorter);
if(sortByOpt!=this.sortHistory[0]){
this.sortHistory.unshift(sortByOpt);
}};
function getItemSorter(sortBys, sortAsc){
return function sorter(itemA, itemB){
for(var i=0, len=sortBys.length; i < len; i++){
var sortBy=sortBys[i];
var a=itemA.sortData[ sortBy ];
var b=itemB.sortData[ sortBy ];
if(a > b||a < b){
var isAscending=sortAsc[ sortBy ]!==undefined ? sortAsc[ sortBy ]:sortAsc;
var direction=isAscending ? 1:-1;
return(a > b ? 1:-1) * direction;
}}
return 0;
};}
Isotope.prototype._mode=function(){
var layoutMode=this.options.layoutMode;
var mode=this.modes[ layoutMode ];
if(!mode){
throw new Error('No layout mode: ' + layoutMode);
}
mode.options=this.options[ layoutMode ];
return mode;
};
Isotope.prototype._resetLayout=function(){
Outlayer.prototype._resetLayout.call(this);
this._mode()._resetLayout();
};
Isotope.prototype._getItemLayoutPosition=function(item){
return this._mode()._getItemLayoutPosition(item);
};
Isotope.prototype._manageStamp=function(stamp){
this._mode()._manageStamp(stamp);
};
Isotope.prototype._getContainerSize=function(){
return this._mode()._getContainerSize();
};
Isotope.prototype.needsResizeLayout=function(){
return this._mode().needsResizeLayout();
};
Isotope.prototype.appended=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var filteredItems=this._filterRevealAdded(items);
this.filteredItems=this.filteredItems.concat(filteredItems);
};
Isotope.prototype.prepended=function(elems){
var items=this._itemize(elems);
if(!items.length){
return;
}
this._resetLayout();
this._manageStamps();
var filteredItems=this._filterRevealAdded(items);
this.layoutItems(this.filteredItems);
this.filteredItems=filteredItems.concat(this.filteredItems);
this.items=items.concat(this.items);
};
Isotope.prototype._filterRevealAdded=function(items){
var filtered=this._filter(items);
this.hide(filtered.needHide);
this.reveal(filtered.matches);
this.layoutItems(filtered.matches, true);
return filtered.matches;
};
Isotope.prototype.insert=function(elems){
var items=this.addItems(elems);
if(!items.length){
return;
}
var i, item;
var len=items.length;
for(i=0; i < len; i++){
item=items[i];
this.element.appendChild(item.element);
}
var filteredInsertItems=this._filter(items).matches;
for(i=0; i < len; i++){
items[i].isLayoutInstant=true;
}
this.arrange();
for(i=0; i < len; i++){
delete items[i].isLayoutInstant;
}
this.reveal(filteredInsertItems);
};
var _remove=Isotope.prototype.remove;
Isotope.prototype.remove=function(elems){
elems=utils.makeArray(elems);
var removeItems=this.getItems(elems);
_remove.call(this, elems);
var len=removeItems&&removeItems.length;
if(!len){
return;
}
for(var i=0; i < len; i++){
var item=removeItems[i];
utils.removeFrom(this.filteredItems, item);
}};
Isotope.prototype.shuffle=function(){
for(var i=0, len=this.items.length; i < len; i++){
var item=this.items[i];
item.sortData.random=Math.random();
}
this.options.sortBy='random';
this._sort();
this._layout();
};
Isotope.prototype._noTransition=function(fn){
var transitionDuration=this.options.transitionDuration;
this.options.transitionDuration=0;
var returnValue=fn.call(this);
this.options.transitionDuration=transitionDuration;
return returnValue;
};
Isotope.prototype.getFilteredItemElements=function(){
var elems=[];
for(var i=0, len=this.filteredItems.length; i < len; i++){
elems.push(this.filteredItems[i].element);
}
return elems;
};
return Isotope;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/rect',factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.Packery=window.Packery||{};
window.Packery.Rect=factory();
}}(window, function factory(){
function Rect(props){
for(var prop in Rect.defaults){
this[ prop ]=Rect.defaults[ prop ];
}
for(prop in props){
this[ prop ]=props[ prop ];
}}
Rect.defaults={
x: 0,
y: 0,
width: 0,
height: 0
};
var proto=Rect.prototype;
proto.contains=function(rect){
var otherWidth=rect.width||0;
var otherHeight=rect.height||0;
return this.x <=rect.x &&
this.y <=rect.y &&
this.x + this.width >=rect.x + otherWidth &&
this.y + this.height >=rect.y + otherHeight;
};
proto.overlaps=function(rect){
var thisRight=this.x + this.width;
var thisBottom=this.y + this.height;
var rectRight=rect.x + rect.width;
var rectBottom=rect.y + rect.height;
return this.x < rectRight &&
thisRight > rect.x &&
this.y < rectBottom &&
thisBottom > rect.y;
};
proto.getMaximalFreeRects=function(rect){
if(!this.overlaps(rect)){
return false;
}
var freeRects=[];
var freeRect;
var thisRight=this.x + this.width;
var thisBottom=this.y + this.height;
var rectRight=rect.x + rect.width;
var rectBottom=rect.y + rect.height;
if(this.y < rect.y){
freeRect=new Rect({
x: this.x,
y: this.y,
width: this.width,
height: rect.y - this.y
});
freeRects.push(freeRect);
}
if(thisRight > rectRight){
freeRect=new Rect({
x: rectRight,
y: this.y,
width: thisRight - rectRight,
height: this.height
});
freeRects.push(freeRect);
}
if(thisBottom > rectBottom){
freeRect=new Rect({
x: this.x,
y: rectBottom,
width: this.width,
height: thisBottom - rectBottom
});
freeRects.push(freeRect);
}
if(this.x < rect.x){
freeRect=new Rect({
x: this.x,
y: this.y,
width: rect.x - this.x,
height: this.height
});
freeRects.push(freeRect);
}
return freeRects;
};
proto.canFit=function(rect){
return this.width >=rect.width&&this.height >=rect.height;
};
return Rect;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/packer',[ './rect' ], factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('./rect')
);
}else{
var Packery=window.Packery=window.Packery||{};
Packery.Packer=factory(Packery.Rect);
}}(window, function factory(Rect){
function Packer(width, height, sortDirection){
this.width=width||0;
this.height=height||0;
this.sortDirection=sortDirection||'downwardLeftToRight';
this.reset();
}
var proto=Packer.prototype;
proto.reset=function(){
this.spaces=[];
var initialSpace=new Rect({
x: 0,
y: 0,
width: this.width,
height: this.height
});
this.spaces.push(initialSpace);
this.sorter=sorters[ this.sortDirection ]||sorters.downwardLeftToRight;
};
proto.pack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
if(space.canFit(rect)){
this.placeInSpace(rect, space);
break;
}}
};
proto.columnPack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var canFitInSpaceColumn=space.x <=rect.x &&
space.x + space.width >=rect.x + rect.width &&
space.height >=rect.height - 0.01;
if(canFitInSpaceColumn){
rect.y=space.y;
this.placed(rect);
break;
}}
};
proto.rowPack=function(rect){
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var canFitInSpaceRow=space.y <=rect.y &&
space.y + space.height >=rect.y + rect.height &&
space.width >=rect.width - 0.01;
if(canFitInSpaceRow){
rect.x=space.x;
this.placed(rect);
break;
}}
};
proto.placeInSpace=function(rect, space){
rect.x=space.x;
rect.y=space.y;
this.placed(rect);
};
proto.placed=function(rect){
var revisedSpaces=[];
for(var i=0; i < this.spaces.length; i++){
var space=this.spaces[i];
var newSpaces=space.getMaximalFreeRects(rect);
if(newSpaces){
revisedSpaces.push.apply(revisedSpaces, newSpaces);
}else{
revisedSpaces.push(space);
}}
this.spaces=revisedSpaces;
this.mergeSortSpaces();
};
proto.mergeSortSpaces=function(){
Packer.mergeRects(this.spaces);
this.spaces.sort(this.sorter);
};
proto.addSpace=function(rect){
this.spaces.push(rect);
this.mergeSortSpaces();
};
Packer.mergeRects=function(rects){
var i=0;
var rect=rects[i];
rectLoop:
while(rect){
var j=0;
var compareRect=rects[ i + j ];
while(compareRect){
if(compareRect==rect){
j++;
}else if(compareRect.contains(rect)){
rects.splice(i, 1);
rect=rects[i];
continue rectLoop;
}else if(rect.contains(compareRect)){
rects.splice(i + j, 1);
}else{
j++;
}
compareRect=rects[ i + j ];
}
i++;
rect=rects[i];
}
return rects;
};
var sorters={
downwardLeftToRight: function(a, b){
return a.y - b.y||a.x - b.x;
},
rightwardTopToBottom: function(a, b){
return a.x - b.x||a.y - b.y;
}};
return Packer;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/item',[
'outlayer/outlayer',
'./rect'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('outlayer'),
require('./rect')
);
}else{
window.Packery.Item=factory(
window.Outlayer,
window.Packery.Rect
);
}}(window, function factory(Outlayer, Rect){
var docElemStyle=document.documentElement.style;
var transformProperty=typeof docElemStyle.transform=='string' ?
'transform':'WebkitTransform';
var Item=function PackeryItem(){
Outlayer.Item.apply(this, arguments);
};
var proto=Item.prototype=Object.create(Outlayer.Item.prototype);
var __create=proto._create;
proto._create=function(){
__create.call(this);
this.rect=new Rect();
};
var _moveTo=proto.moveTo;
proto.moveTo=function(x, y){
var dx=Math.abs(this.position.x - x);
var dy=Math.abs(this.position.y - y);
var canHackGoTo=this.layout.dragItemCount&&!this.isPlacing &&
!this.isTransitioning&&dx < 1&&dy < 1;
if(canHackGoTo){
this.goTo(x, y);
return;
}
_moveTo.apply(this, arguments);
};
proto.enablePlacing=function(){
this.removeTransitionStyles();
if(this.isTransitioning&&transformProperty){
this.element.style[ transformProperty ]='none';
}
this.isTransitioning=false;
this.getSize();
this.layout._setRectSize(this.element, this.rect);
this.isPlacing=true;
};
proto.disablePlacing=function(){
this.isPlacing=false;
};
proto.removeElem=function(){
this.element.parentNode.removeChild(this.element);
this.layout.packer.addSpace(this.rect);
this.emitEvent('remove', [ this ]);
};
proto.showDropPlaceholder=function(){
var dropPlaceholder=this.dropPlaceholder;
if(!dropPlaceholder){
dropPlaceholder=this.dropPlaceholder=document.createElement('div');
dropPlaceholder.className='packery-drop-placeholder';
dropPlaceholder.style.position='absolute';
}
dropPlaceholder.style.width=this.size.width + 'px';
dropPlaceholder.style.height=this.size.height + 'px';
this.positionDropPlaceholder();
this.layout.element.appendChild(dropPlaceholder);
};
proto.positionDropPlaceholder=function(){
this.dropPlaceholder.style[ transformProperty ]='translate(' +
this.rect.x + 'px, ' + this.rect.y + 'px)';
};
proto.hideDropPlaceholder=function(){
this.layout.element.removeChild(this.dropPlaceholder);
};
return Item;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define('packery/js/packery',[
'get-size/get-size',
'outlayer/outlayer',
'./rect',
'./packer',
'./item'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('get-size'),
require('outlayer'),
require('./rect'),
require('./packer'),
require('./item')
);
}else{
window.Packery=factory(
window.getSize,
window.Outlayer,
window.Packery.Rect,
window.Packery.Packer,
window.Packery.Item
);
}}(window, function factory(getSize, Outlayer, Rect, Packer, Item){
Rect.prototype.canFit=function(rect){
return this.width >=rect.width - 1&&this.height >=rect.height - 1;
};
var Packery=Outlayer.create('packery');
Packery.Item=Item;
var proto=Packery.prototype;
proto._create=function(){
Outlayer.prototype._create.call(this);
this.packer=new Packer();
this.shiftPacker=new Packer();
this.isEnabled=true;
this.dragItemCount=0;
var _this=this;
this.handleDraggabilly={
dragStart: function(){
_this.itemDragStart(this.element);
},
dragMove: function(){
_this.itemDragMove(this.element, this.position.x, this.position.y);
},
dragEnd: function(){
_this.itemDragEnd(this.element);
}};
this.handleUIDraggable={
start: function handleUIDraggableStart(event, ui){
if(!ui){
return;
}
_this.itemDragStart(event.currentTarget);
},
drag: function handleUIDraggableDrag(event, ui){
if(!ui){
return;
}
_this.itemDragMove(event.currentTarget, ui.position.left, ui.position.top);
},
stop: function handleUIDraggableStop(event, ui){
if(!ui){
return;
}
_this.itemDragEnd(event.currentTarget);
}};};
proto._resetLayout=function(){
this.getSize();
this._getMeasurements();
var width, height, sortDirection;
if(this._getOption('horizontal')){
width=Infinity;
height=this.size.innerHeight + this.gutter;
sortDirection='rightwardTopToBottom';
}else{
width=this.size.innerWidth + this.gutter;
height=Infinity;
sortDirection='downwardLeftToRight';
}
this.packer.width=this.shiftPacker.width=width;
this.packer.height=this.shiftPacker.height=height;
this.packer.sortDirection=this.shiftPacker.sortDirection=sortDirection;
this.packer.reset();
this.maxY=0;
this.maxX=0;
};
proto._getMeasurements=function(){
this._getMeasurement('columnWidth', 'width');
this._getMeasurement('rowHeight', 'height');
this._getMeasurement('gutter', 'width');
};
proto._getItemLayoutPosition=function(item){
this._setRectSize(item.element, item.rect);
if(this.isShifting||this.dragItemCount > 0){
var packMethod=this._getPackMethod();
this.packer[ packMethod ](item.rect);
}else{
this.packer.pack(item.rect);
}
this._setMaxXY(item.rect);
return item.rect;
};
proto.shiftLayout=function(){
this.isShifting=true;
this.layout();
delete this.isShifting;
};
proto._getPackMethod=function(){
return this._getOption('horizontal') ? 'rowPack':'columnPack';
};
proto._setMaxXY=function(rect){
this.maxX=Math.max(rect.x + rect.width, this.maxX);
this.maxY=Math.max(rect.y + rect.height, this.maxY);
};
proto._setRectSize=function(elem, rect){
var size=getSize(elem);
var w=size.outerWidth;
var h=size.outerHeight;
if(w||h){
w=this._applyGridGutter(w, this.columnWidth);
h=this._applyGridGutter(h, this.rowHeight);
}
rect.width=Math.min(w, this.packer.width);
rect.height=Math.min(h, this.packer.height);
};
proto._applyGridGutter=function(measurement, gridSize){
if(!gridSize){
return measurement + this.gutter;
}
gridSize +=this.gutter;
var remainder=measurement % gridSize;
var mathMethod=remainder&&remainder < 1 ? 'round':'ceil';
measurement=Math[ mathMethod ](measurement / gridSize) * gridSize;
return measurement;
};
proto._getContainerSize=function(){
if(this._getOption('horizontal')){
return {
width: this.maxX - this.gutter
};}else{
return {
height: this.maxY - this.gutter
};}};
proto._manageStamp=function(elem){
var item=this.getItem(elem);
var rect;
if(item&&item.isPlacing){
rect=item.rect;
}else{
var offset=this._getElementOffset(elem);
rect=new Rect({
x: this._getOption('originLeft') ? offset.left:offset.right,
y: this._getOption('originTop') ? offset.top:offset.bottom
});
}
this._setRectSize(elem, rect);
this.packer.placed(rect);
this._setMaxXY(rect);
};
function verticalSorter(a, b){
return a.position.y - b.position.y||a.position.x - b.position.x;
}
function horizontalSorter(a, b){
return a.position.x - b.position.x||a.position.y - b.position.y;
}
proto.sortItemsByPosition=function(){
var sorter=this._getOption('horizontal') ? horizontalSorter:verticalSorter;
this.items.sort(sorter);
};
proto.fit=function(elem, x, y){
var item=this.getItem(elem);
if(!item){
return;
}
this.stamp(item.element);
item.enablePlacing();
this.updateShiftTargets(item);
x=x===undefined ? item.rect.x: x;
y=y===undefined ? item.rect.y: y;
this.shift(item, x, y);
this._bindFitEvents(item);
item.moveTo(item.rect.x, item.rect.y);
this.shiftLayout();
this.unstamp(item.element);
this.sortItemsByPosition();
item.disablePlacing();
};
proto._bindFitEvents=function(item){
var _this=this;
var ticks=0;
function onLayout(){
ticks++;
if(ticks!=2){
return;
}
_this.dispatchEvent('fitComplete', null, [ item ]);
}
item.once('layout', onLayout);
this.once('layoutComplete', onLayout);
};
proto.resize=function(){
if(!this.isResizeBound||!this.needsResizeLayout()){
return;
}
if(this.options.shiftPercentResize){
this.resizeShiftPercentLayout();
}else{
this.layout();
}};
proto.needsResizeLayout=function(){
var size=getSize(this.element);
var innerSize=this._getOption('horizontal') ? 'innerHeight':'innerWidth';
return size[ innerSize ]!=this.size[ innerSize ];
};
proto.resizeShiftPercentLayout=function(){
var items=this._getItemsForLayout(this.items);
var isHorizontal=this._getOption('horizontal');
var coord=isHorizontal ? 'y':'x';
var measure=isHorizontal ? 'height':'width';
var segmentName=isHorizontal ? 'rowHeight':'columnWidth';
var innerSize=isHorizontal ? 'innerHeight':'innerWidth';
var previousSegment=this[ segmentName ];
previousSegment=previousSegment&&previousSegment + this.gutter;
if(previousSegment){
this._getMeasurements();
var currentSegment=this[ segmentName ] + this.gutter;
items.forEach(function(item){
var seg=Math.round(item.rect[ coord ] / previousSegment);
item.rect[ coord ]=seg * currentSegment;
});
}else{
var currentSize=getSize(this.element)[ innerSize ] + this.gutter;
var previousSize=this.packer[ measure ];
items.forEach(function(item){
item.rect[ coord ]=(item.rect[ coord ] / previousSize) * currentSize;
});
}
this.shiftLayout();
};
proto.itemDragStart=function(elem){
if(!this.isEnabled){
return;
}
this.stamp(elem);
var item=this.getItem(elem);
if(!item){
return;
}
item.enablePlacing();
item.showDropPlaceholder();
this.dragItemCount++;
this.updateShiftTargets(item);
};
proto.updateShiftTargets=function(dropItem){
this.shiftPacker.reset();
this._getBoundingRect();
var isOriginLeft=this._getOption('originLeft');
var isOriginTop=this._getOption('originTop');
this.stamps.forEach(function(stamp){
var item=this.getItem(stamp);
if(item&&item.isPlacing){
return;
}
var offset=this._getElementOffset(stamp);
var rect=new Rect({
x: isOriginLeft ? offset.left:offset.right,
y: isOriginTop ? offset.top:offset.bottom
});
this._setRectSize(stamp, rect);
this.shiftPacker.placed(rect);
}, this);
var isHorizontal=this._getOption('horizontal');
var segmentName=isHorizontal ? 'rowHeight':'columnWidth';
var measure=isHorizontal ? 'height':'width';
this.shiftTargetKeys=[];
this.shiftTargets=[];
var boundsSize;
var segment=this[ segmentName ];
segment=segment&&segment + this.gutter;
if(segment){
var segmentSpan=Math.ceil(dropItem.rect[ measure ] / segment);
var segs=Math.floor(( this.shiftPacker[ measure ] + this.gutter) / segment);
boundsSize=(segs - segmentSpan) * segment;
for(var i=0; i < segs; i++){
this._addShiftTarget(i * segment, 0, boundsSize);
}}else{
boundsSize=(this.shiftPacker[ measure ] + this.gutter) - dropItem.rect[ measure ];
this._addShiftTarget(0, 0, boundsSize);
}
var items=this._getItemsForLayout(this.items);
var packMethod=this._getPackMethod();
items.forEach(function(item){
var rect=item.rect;
this._setRectSize(item.element, rect);
this.shiftPacker[ packMethod ](rect);
this._addShiftTarget(rect.x, rect.y, boundsSize);
var cornerX=isHorizontal ? rect.x + rect.width:rect.x;
var cornerY=isHorizontal ? rect.y:rect.y + rect.height;
this._addShiftTarget(cornerX, cornerY, boundsSize);
if(segment){
var segSpan=Math.round(rect[ measure ] / segment);
for(var i=1; i < segSpan; i++){
var segX=isHorizontal ? cornerX:rect.x + segment * i;
var segY=isHorizontal ? rect.y + segment * i:cornerY;
this._addShiftTarget(segX, segY, boundsSize);
}}
}, this);
};
proto._addShiftTarget=function(x, y, boundsSize){
var checkCoord=this._getOption('horizontal') ? y:x;
if(checkCoord!==0&&checkCoord > boundsSize){
return;
}
var key=x + ',' + y;
var hasKey=this.shiftTargetKeys.indexOf(key)!=-1;
if(hasKey){
return;
}
this.shiftTargetKeys.push(key);
this.shiftTargets.push({ x: x, y: y });
};
proto.shift=function(item, x, y){
var shiftPosition;
var minDistance=Infinity;
var position={ x: x, y: y };
this.shiftTargets.forEach(function(target){
var distance=getDistance(target, position);
if(distance < minDistance){
shiftPosition=target;
minDistance=distance;
}});
item.rect.x=shiftPosition.x;
item.rect.y=shiftPosition.y;
};
function getDistance(a, b){
var dx=b.x - a.x;
var dy=b.y - a.y;
return Math.sqrt(dx * dx + dy * dy);
}
var DRAG_THROTTLE_TIME=120;
proto.itemDragMove=function(elem, x, y){
var item=this.isEnabled&&this.getItem(elem);
if(!item){
return;
}
x -=this.size.paddingLeft;
y -=this.size.paddingTop;
var _this=this;
function onDrag(){
_this.shift(item, x, y);
item.positionDropPlaceholder();
_this.layout();
}
var now=new Date();
if(this._itemDragTime&&now - this._itemDragTime < DRAG_THROTTLE_TIME){
clearTimeout(this.dragTimeout);
this.dragTimeout=setTimeout(onDrag, DRAG_THROTTLE_TIME);
}else{
onDrag();
this._itemDragTime=now;
}};
proto.itemDragEnd=function(elem){
var item=this.isEnabled&&this.getItem(elem);
if(!item){
return;
}
clearTimeout(this.dragTimeout);
item.element.classList.add('is-positioning-post-drag');
var completeCount=0;
var _this=this;
function onDragEndLayoutComplete(){
completeCount++;
if(completeCount!=2){
return;
}
item.element.classList.remove('is-positioning-post-drag');
item.hideDropPlaceholder();
_this.dispatchEvent('dragItemPositioned', null, [ item ]);
}
item.once('layout', onDragEndLayoutComplete);
this.once('layoutComplete', onDragEndLayoutComplete);
item.moveTo(item.rect.x, item.rect.y);
this.layout();
this.dragItemCount=Math.max(0, this.dragItemCount - 1);
this.sortItemsByPosition();
item.disablePlacing();
this.unstamp(item.element);
};
proto.bindDraggabillyEvents=function(draggie){
this._bindDraggabillyEvents(draggie, 'on');
};
proto.unbindDraggabillyEvents=function(draggie){
this._bindDraggabillyEvents(draggie, 'off');
};
proto._bindDraggabillyEvents=function(draggie, method){
var handlers=this.handleDraggabilly;
draggie[ method ]('dragStart', handlers.dragStart);
draggie[ method ]('dragMove', handlers.dragMove);
draggie[ method ]('dragEnd', handlers.dragEnd);
};
proto.bindUIDraggableEvents=function($elems){
this._bindUIDraggableEvents($elems, 'on');
};
proto.unbindUIDraggableEvents=function($elems){
this._bindUIDraggableEvents($elems, 'off');
};
proto._bindUIDraggableEvents=function($elems, method){
var handlers=this.handleUIDraggable;
$elems
[ method ]('dragstart', handlers.start)
[ method ]('drag', handlers.drag)
[ method ]('dragstop', handlers.stop);
};
var _destroy=proto.destroy;
proto.destroy=function(){
_destroy.apply(this, arguments);
this.isEnabled=false;
};
Packery.Rect=Rect;
Packery.Packer=Packer;
return Packery;
}));
(function(window, factory){
if(typeof define=='function'&&define.amd){
define([
'isotope-layout/js/layout-mode',
'packery/js/packery'
],
factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory(
require('isotope-layout/js/layout-mode'),
require('packery')
);
}else{
factory(
window.Isotope.LayoutMode,
window.Packery
);
}}(window, function factor(LayoutMode, Packery){
var PackeryMode=LayoutMode.create('packery');
var proto=PackeryMode.prototype;
var keepModeMethods={
_getElementOffset: true,
_getMeasurement: true
};
for(var method in Packery.prototype){
if(!keepModeMethods[ method ]){
proto[ method ]=Packery.prototype[ method ];
}}
var _resetLayout=proto._resetLayout;
proto._resetLayout=function(){
this.packer=this.packer||new Packery.Packer();
this.shiftPacker=this.shiftPacker||new Packery.Packer();
_resetLayout.apply(this, arguments);
};
var _getItemLayoutPosition=proto._getItemLayoutPosition;
proto._getItemLayoutPosition=function(item){
item.rect=item.rect||new Packery.Rect();
return _getItemLayoutPosition.call(this, item);
};
var _needsResizeLayout=proto.needsResizeLayout;
proto.needsResizeLayout=function(){
if(this._getOption('horizontal')){
return this.needsVerticalResizeLayout();
}else{
return _needsResizeLayout.call(this);
}};
var _getOption=proto._getOption;
proto._getOption=function(option){
if(option=='horizontal'){
return this.options.isHorizontal!==undefined ?
this.options.isHorizontal:this.options.horizontal;
}
return _getOption.apply(this.isotope, arguments);
};
return PackeryMode;
}));
(function(window, factory){
if(typeof define==='function'&&define.amd){
define([
'isotope/js/layout-mode'
],
factory);
}else if(typeof exports==='object'){
module.exports=factory(
require('isotope-layout/js/layout-mode')
);
}else{
factory(
window.Isotope.LayoutMode
);
}}(window, function factory(LayoutMode){
'use strict';
var CellsByRow=LayoutMode.create('cellsByRow');
var proto=CellsByRow.prototype;
proto._resetLayout=function(){
this.itemIndex=0;
this.getColumnWidth();
this.getRowHeight();
this.cols=Math.floor(this.isotope.size.innerWidth / this.columnWidth);
this.cols=Math.max(this.cols, 1);
};
proto._getItemLayoutPosition=function(item){
item.getSize();
var col=this.itemIndex % this.cols;
var row=Math.floor(this.itemIndex / this.cols);
var x=(col + 0.5) * this.columnWidth - item.size.outerWidth / 2;
var y=(row + 0.5) * this.rowHeight - item.size.outerHeight / 2;
this.itemIndex++;
return { x: x, y: y };};
proto._getContainerSize=function(){
return {
height: Math.ceil(this.itemIndex / this.cols) * this.rowHeight
};};
return CellsByRow;
}));
(function (factory){
if(typeof define==='function'&&define.amd){
define(['jquery'], factory);
}else{
factory(jQuery);
}}(function ($, undefined){
'use strict';
$.infinitescroll=function infscr(options, callback, element){
this.element=$(element);
if(!this._create(options, callback)){
this.failed=true;
}};
$.infinitescroll.defaults={
loading: {
finished: undefined,
finishedMsg: "Congratulations, you've reached the end of the internet. ",
img: 'data:image/gif;base64,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',
msg: null,
msgText: 'Loading the next set of posts... ',
selector: null,
speed: 'fast',
start: undefined
},
state: {
isDuringAjax: false,
isInvalidPage: false,
isDestroyed: false,
isDone: false,
isPaused: false,
isBeyondMaxPage: false,
currPage: 1
},
debug: false,
behavior: undefined,
binder: $(window),
nextSelector: 'div.navigation a:first',
navSelector: 'div.navigation',
contentSelector: null,
extraScrollPx: 150,
itemSelector: 'div.post',
animate: false,
pathParse: undefined,
dataType: 'html',
appendCallback: true,
bufferPx: 40,
errorCallback: function (){ },
infid: 0,
pixelsFromNavToBottom: undefined,
path: undefined,
prefill: false,
maxPage: undefined
};
$.infinitescroll.prototype={
_binding: function infscr_binding(binding){
var instance=this,
opts=instance.options;
opts.v='2.0b2.120520';
if(!!opts.behavior&&this['_binding_'+opts.behavior]!==undefined){
this['_binding_'+opts.behavior].call(this);
return;
}
if(binding!=='bind'&&binding!=='unbind'){
this._debug('Binding value ' + binding + ' not valid');
return false;
}
if(binding==='unbind'){
(this.options.binder).unbind('smartscroll.infscr.' + instance.options.infid);
}else{
(this.options.binder)[binding]('smartscroll.infscr.' + instance.options.infid, function (){
instance.scroll();
});
}
this._debug('Binding', binding);
},
_create: function infscr_create(options, callback){
var opts=$.extend(true, {}, $.infinitescroll.defaults, options);
this.options=opts;
var $window=$(window);
var instance=this;
if(!instance._validate(options)){
return false;
}
var path=$(opts.nextSelector).attr('href');
if(!path){
this._debug('Navigation selector not found');
return false;
}
opts.path=opts.path||this._determinepath(path);
opts.contentSelector=opts.contentSelector||this.element;
opts.loading.selector=opts.loading.selector||opts.contentSelector;
opts.loading.msg=opts.loading.msg||$('' + opts.loading.msgText + '
');
(new Image()).src=opts.loading.img;
if(opts.pixelsFromNavToBottom===undefined){
opts.pixelsFromNavToBottom=$(document).height() - $(opts.navSelector).offset().top;
this._debug('pixelsFromNavToBottom: ' + opts.pixelsFromNavToBottom);
}
var self=this;
opts.loading.start=opts.loading.start||function(){
$(opts.navSelector).hide();
opts.loading.msg
.appendTo(opts.loading.selector)
.show(opts.loading.speed, $.proxy(function(){
this.beginAjax(opts);
}, self));
};
opts.loading.finished=opts.loading.finished||function(){
if(!opts.state.isBeyondMaxPage)
opts.loading.msg.fadeOut(opts.loading.speed);
};
opts.callback=function(instance, data, url){
if(!!opts.behavior&&instance['_callback_'+opts.behavior]!==undefined){
instance['_callback_'+opts.behavior].call($(opts.contentSelector)[0], data, url);
}
if(callback){
callback.call($(opts.contentSelector)[0], data, opts, url);
}
if(opts.prefill){
$window.bind('resize.infinite-scroll', instance._prefill);
}};
if(options.debug){
if(Function.prototype.bind&&(typeof console==='object'||typeof console==='function')&&typeof console.log==='object'){
['log','info','warn','error','assert','dir','clear','profile','profileEnd']
.forEach(function (method){
console[method]=this.call(console[method], console);
}, Function.prototype.bind);
}}
this._setup();
if(opts.prefill){
this._prefill();
}
return true;
},
_prefill: function infscr_prefill(){
var instance=this;
var $window=$(window);
function needsPrefill(){
return($(instance.options.contentSelector).height() <=$window.height());
}
this._prefill=function(){
if(needsPrefill()){
instance.scroll();
}
$window.bind('resize.infinite-scroll', function(){
if(needsPrefill()){
$window.unbind('resize.infinite-scroll');
instance.scroll();
}});
};
this._prefill();
},
_debug: function infscr_debug(){
if(true!==this.options.debug){
return;
}
if(typeof console!=='undefined'&&typeof console.log==='function'){
if((Array.prototype.slice.call(arguments)).length===1&&typeof Array.prototype.slice.call(arguments)[0]==='string'){
console.log((Array.prototype.slice.call(arguments)).toString());
}else{
console.log(Array.prototype.slice.call(arguments));
}}else if(!Function.prototype.bind&&typeof console!=='undefined'&&typeof console.log==='object'){
Function.prototype.call.call(console.log, console, Array.prototype.slice.call(arguments));
}},
_determinepath: function infscr_determinepath(path){
var opts=this.options;
if(!!opts.behavior&&this['_determinepath_'+opts.behavior]!==undefined){
return this['_determinepath_'+opts.behavior].call(this,path);
}
if(!!opts.pathParse){
this._debug('pathParse manual');
return opts.pathParse(path, this.options.state.currPage+1);
}else if(path.match(/^(.*?)\b2\b(.*?$)/)){
path=path.match(/^(.*?)\b2\b(.*?$)/).slice(1);
}else if(path.match(/^(.*?)2(.*?$)/)){
if(path.match(/^(.*?page=)2(\/.*|$)/)){
path=path.match(/^(.*?page=)2(\/.*|$)/).slice(1);
return path;
}
path=path.match(/^(.*?)2(.*?$)/).slice(1);
}else{
if(path.match(/^(.*?page=)1(\/.*|$)/)){
path=path.match(/^(.*?page=)1(\/.*|$)/).slice(1);
return path;
}else{
this._debug("Sorry, we couldn't parse your Next (Previous Posts) URL. Verify your the css selector points to the correct A tag. If you still get this error: yell, scream, and kindly ask for help at infinite-scroll.com.");
opts.state.isInvalidPage=true;
}}
this._debug('determinePath', path);
return path;
},
_error: function infscr_error(xhr){
var opts=this.options;
if(!!opts.behavior&&this['_error_'+opts.behavior]!==undefined){
this['_error_'+opts.behavior].call(this,xhr);
return;
}
if(xhr!=='destroy'&&xhr!=='end'){
xhr='unknown';
}
this._debug('Error', xhr);
if(xhr==='end'||opts.state.isBeyondMaxPage){
this._showdonemsg();
}
opts.state.isDone=true;
opts.state.currPage=1;
opts.state.isPaused=false;
opts.state.isBeyondMaxPage=false;
this._binding('unbind');
},
_loadcallback: function infscr_loadcallback(box, data, url){
var opts=this.options,
callback=this.options.callback,
result=(opts.state.isDone) ? 'done':(!opts.appendCallback) ? 'no-append':'append',
frag;
if(!!opts.behavior&&this['_loadcallback_'+opts.behavior]!==undefined){
this['_loadcallback_'+opts.behavior].call(this,box,data);
return;
}
switch (result){
case 'done':
this._showdonemsg();
return false;
case 'no-append':
if(opts.dataType==='html'){
data='' + data + '
';
data=$(data).find(opts.itemSelector);
}
if(data.length===0){
return this._error('end');
}
break;
case 'append':
var children=box.children();
if(children.length===0){
return this._error('end');
}
frag=document.createDocumentFragment();
while (box[0].firstChild){
frag.appendChild(box[0].firstChild);
}
this._debug('contentSelector', $(opts.contentSelector)[0]);
$(opts.contentSelector)[0].appendChild(frag);
data=children.get();
break;
}
opts.loading.finished.call($(opts.contentSelector)[0],opts);
if(opts.animate){
var scrollTo=$(window).scrollTop() + $(opts.loading.msg).height() + opts.extraScrollPx + 'px';
$('html,body').animate({ scrollTop: scrollTo }, 800, function (){ opts.state.isDuringAjax=false; });
}
if(!opts.animate){
opts.state.isDuringAjax=false;
}
callback(this, data, url);
if(opts.prefill){
this._prefill();
}},
_nearbottom: function infscr_nearbottom(){
var opts=this.options,
pixelsFromWindowBottomToBottom=0 + $(document).height() - (opts.binder.scrollTop()) - $(window).height();
if(!!opts.behavior&&this['_nearbottom_'+opts.behavior]!==undefined){
return this['_nearbottom_'+opts.behavior].call(this);
}
this._debug('math:', pixelsFromWindowBottomToBottom, opts.pixelsFromNavToBottom);
return (pixelsFromWindowBottomToBottom - opts.bufferPx < opts.pixelsFromNavToBottom);
},
_pausing: function infscr_pausing(pause){
var opts=this.options;
if(!!opts.behavior&&this['_pausing_'+opts.behavior]!==undefined){
this['_pausing_'+opts.behavior].call(this,pause);
return;
}
if(pause!=='pause'&&pause!=='resume'&&pause!==null){
this._debug('Invalid argument. Toggling pause value instead');
}
pause=(pause&&(pause==='pause'||pause==='resume')) ? pause:'toggle';
switch (pause){
case 'pause':
opts.state.isPaused=true;
break;
case 'resume':
opts.state.isPaused=false;
break;
case 'toggle':
opts.state.isPaused = !opts.state.isPaused;
break;
}
this._debug('Paused', opts.state.isPaused);
return false;
},
_setup: function infscr_setup(){
var opts=this.options;
if(!!opts.behavior&&this['_setup_'+opts.behavior]!==undefined){
this['_setup_'+opts.behavior].call(this);
return;
}
this._binding('bind');
return false;
},
_showdonemsg: function infscr_showdonemsg(){
var opts=this.options;
if(!!opts.behavior&&this['_showdonemsg_'+opts.behavior]!==undefined){
this['_showdonemsg_'+opts.behavior].call(this);
return;
}
opts.loading.msg
.find('img')
.hide()
.parent()
.find('div').html(opts.loading.finishedMsg).animate({ opacity: 1 }, 2000, function (){
$(this).parent().fadeOut(opts.loading.speed);
});
opts.errorCallback.call($(opts.contentSelector)[0],'done');
},
_validate: function infscr_validate(opts){
for (var key in opts){
if(key.indexOf&&key.indexOf('Selector') > -1&&$(opts[key]).length===0){
this._debug('Your ' + key + ' found no elements.');
return false;
}}
return true;
},
bind: function infscr_bind(){
this._binding('bind');
},
destroy: function infscr_destroy(){
this.options.state.isDestroyed=true;
this.options.loading.finished();
return this._error('destroy');
},
pause: function infscr_pause(){
this._pausing('pause');
},
resume: function infscr_resume(){
this._pausing('resume');
},
beginAjax: function infscr_ajax(opts){
var instance=this,
path=opts.path,
box, desturl, method, condition;
opts.state.currPage++;
if(opts.maxPage!==undefined&&opts.state.currPage > opts.maxPage){
opts.state.isBeyondMaxPage=true;
this.destroy();
return;
}
box=$(opts.contentSelector).is('table, tbody') ? $(' '):$('
');
desturl=(typeof path==='function') ? path(opts.state.currPage):path.join(opts.state.currPage);
instance._debug('heading into ajax', desturl);
method=(opts.dataType==='html'||opts.dataType==='json') ? opts.dataType:'html+callback';
if(opts.appendCallback&&opts.dataType==='html'){
method +='+callback';
}
switch (method){
case 'html+callback':
instance._debug('Using HTML via .load() method');
box.load(desturl + ' ' + opts.itemSelector, undefined, function infscr_ajax_callback(responseText){
instance._loadcallback(box, responseText, desturl);
});
break;
case 'html':
instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
$.ajax({
url: desturl,
dataType: opts.dataType,
complete: function infscr_ajax_callback(jqXHR, textStatus){
condition=(typeof (jqXHR.isResolved)!=='undefined') ? (jqXHR.isResolved()):(textStatus==='success'||textStatus==='notmodified');
if(condition){
instance._loadcallback(box, jqXHR.responseText, desturl);
}else{
instance._error('end');
}}
});
break;
case 'json':
instance._debug('Using ' + (method.toUpperCase()) + ' via $.ajax() method');
$.ajax({
dataType: 'json',
type: 'GET',
url: desturl,
success: function (data, textStatus, jqXHR){
condition=(typeof (jqXHR.isResolved)!=='undefined') ? (jqXHR.isResolved()):(textStatus==='success'||textStatus==='notmodified');
if(opts.appendCallback){
if(opts.template!==undefined){
var theData=opts.template(data);
box.append(theData);
if(condition){
instance._loadcallback(box, theData);
}else{
instance._error('end');
}}else{
instance._debug('template must be defined.');
instance._error('end');
}}else{
if(condition){
instance._loadcallback(box, data, desturl);
}else{
instance._error('end');
}}
},
error: function(){
instance._debug('JSON ajax request failed.');
instance._error('end');
}});
break;
}},
retrieve: function infscr_retrieve(pageNum){
pageNum=pageNum||null;
var instance=this,
opts=instance.options;
if(!!opts.behavior&&this['retrieve_'+opts.behavior]!==undefined){
this['retrieve_'+opts.behavior].call(this,pageNum);
return;
}
if(opts.state.isDestroyed){
this._debug('Instance is destroyed');
return false;
}
opts.state.isDuringAjax=true;
opts.loading.start.call($(opts.contentSelector)[0],opts);
},
scroll: function infscr_scroll(){
var opts=this.options,
state=opts.state;
if(!!opts.behavior&&this['scroll_'+opts.behavior]!==undefined){
this['scroll_'+opts.behavior].call(this);
return;
}
if(state.isDuringAjax||state.isInvalidPage||state.isDone||state.isDestroyed||state.isPaused){
return;
}
if(!this._nearbottom()){
return;
}
this.retrieve();
},
toggle: function infscr_toggle(){
this._pausing();
},
unbind: function infscr_unbind(){
this._binding('unbind');
},
update: function infscr_options(key){
if($.isPlainObject(key)){
this.options=$.extend(true,this.options,key);
}}
};
$.fn.infinitescroll=function infscr_init(options, callback){
var thisCall=typeof options;
switch (thisCall){
case 'string':
var args=Array.prototype.slice.call(arguments, 1);
this.each(function (){
var instance=$.data(this, 'infinitescroll');
if(!instance){
return false;
}
if(!$.isFunction(instance[options])||options.charAt(0)==='_'){
return false;
}
instance[options].apply(instance, args);
});
break;
case 'object':
this.each(function (){
var instance=$.data(this, 'infinitescroll');
if(instance){
instance.update(options);
}else{
instance=new $.infinitescroll(options, callback, this);
if(!instance.failed){
$.data(this, 'infinitescroll', instance);
}}
});
break;
}
return this;
};
var event=$.event,
scrollTimeout;
event.special.smartscroll={
setup: function (){
$(this).bind('scroll', event.special.smartscroll.handler);
},
teardown: function (){
$(this).unbind('scroll', event.special.smartscroll.handler);
},
handler: function (event, execAsap){
var context=this,
args=arguments;
event.type='smartscroll';
if(scrollTimeout){ clearTimeout(scrollTimeout); }
scrollTimeout=setTimeout(function (){
$(context).trigger('smartscroll', args);
}, execAsap==='execAsap' ? 0:100);
}};
$.fn.smartscroll=function (fn){
return fn ? this.bind('smartscroll', fn):this.trigger('smartscroll', ['execAsap']);
};}));
(function(){
'use strict'
var keyCounter=0
var allWaypoints={}
function Waypoint(options){
if(!options){
throw new Error('No options passed to Waypoint constructor')
}
if(!options.element){
throw new Error('No element option passed to Waypoint constructor')
}
if(!options.handler){
throw new Error('No handler option passed to Waypoint constructor')
}
this.key='waypoint-' + keyCounter
this.options=Waypoint.Adapter.extend({}, Waypoint.defaults, options)
this.element=this.options.element
this.adapter=new Waypoint.Adapter(this.element)
this.callback=options.handler
this.axis=this.options.horizontal ? 'horizontal':'vertical'
this.enabled=this.options.enabled
this.triggerPoint=null
this.group=Waypoint.Group.findOrCreate({
name: this.options.group,
axis: this.axis
})
this.context=Waypoint.Context.findOrCreateByElement(this.options.context)
if(Waypoint.offsetAliases[this.options.offset]){
this.options.offset=Waypoint.offsetAliases[this.options.offset]
}
this.group.add(this)
this.context.add(this)
allWaypoints[this.key]=this
keyCounter +=1
}
Waypoint.prototype.queueTrigger=function(direction){
this.group.queueTrigger(this, direction)
}
Waypoint.prototype.trigger=function(args){
if(!this.enabled){
return
}
if(this.callback){
this.callback.apply(this, args)
}}
Waypoint.prototype.destroy=function(){
this.context.remove(this)
this.group.remove(this)
delete allWaypoints[this.key]
}
Waypoint.prototype.disable=function(){
this.enabled=false
return this
}
Waypoint.prototype.enable=function(){
this.context.refresh()
this.enabled=true
return this
}
Waypoint.prototype.next=function(){
return this.group.next(this)
}
Waypoint.prototype.previous=function(){
return this.group.previous(this)
}
Waypoint.invokeAll=function(method){
var allWaypointsArray=[]
for (var waypointKey in allWaypoints){
allWaypointsArray.push(allWaypoints[waypointKey])
}
for (var i=0, end=allWaypointsArray.length; i < end; i++){
allWaypointsArray[i][method]()
}}
Waypoint.destroyAll=function(){
Waypoint.invokeAll('destroy')
}
Waypoint.disableAll=function(){
Waypoint.invokeAll('disable')
}
Waypoint.enableAll=function(){
Waypoint.Context.refreshAll()
for (var waypointKey in allWaypoints){
allWaypoints[waypointKey].enabled=true
}
return this
}
Waypoint.refreshAll=function(){
Waypoint.Context.refreshAll()
}
Waypoint.viewportHeight=function(){
return window.innerHeight||document.documentElement.clientHeight
}
Waypoint.viewportWidth=function(){
return document.documentElement.clientWidth
}
Waypoint.adapters=[]
Waypoint.defaults={
context: window,
continuous: true,
enabled: true,
group: 'default',
horizontal: false,
offset: 0
}
Waypoint.offsetAliases={
'bottom-in-view': function(){
return this.context.innerHeight() - this.adapter.outerHeight()
},
'right-in-view': function(){
return this.context.innerWidth() - this.adapter.outerWidth()
}}
window.Waypoint=Waypoint
}())
;(function(){
'use strict'
function requestAnimationFrameShim(callback){
window.setTimeout(callback, 1000 / 60)
}
var keyCounter=0
var contexts={}
var Waypoint=window.Waypoint
var oldWindowLoad=window.onload
function Context(element){
this.element=element
this.Adapter=Waypoint.Adapter
this.adapter=new this.Adapter(element)
this.key='waypoint-context-' + keyCounter
this.didScroll=false
this.didResize=false
this.oldScroll={
x: this.adapter.scrollLeft(),
y: this.adapter.scrollTop()
}
this.waypoints={
vertical: {},
horizontal: {}}
element.waypointContextKey=this.key
contexts[element.waypointContextKey]=this
keyCounter +=1
if(!Waypoint.windowContext){
Waypoint.windowContext=true
Waypoint.windowContext=new Context(window)
}
this.createThrottledScrollHandler()
this.createThrottledResizeHandler()
}
Context.prototype.add=function(waypoint){
var axis=waypoint.options.horizontal ? 'horizontal':'vertical'
this.waypoints[axis][waypoint.key]=waypoint
this.refresh()
}
Context.prototype.checkEmpty=function(){
var horizontalEmpty=this.Adapter.isEmptyObject(this.waypoints.horizontal)
var verticalEmpty=this.Adapter.isEmptyObject(this.waypoints.vertical)
var isWindow=this.element==this.element.window
if(horizontalEmpty&&verticalEmpty&&!isWindow){
this.adapter.off('.waypoints')
delete contexts[this.key]
}}
Context.prototype.createThrottledResizeHandler=function(){
var self=this
function resizeHandler(){
self.handleResize()
self.didResize=false
}
this.adapter.on('resize.waypoints', function(){
if(!self.didResize){
self.didResize=true
Waypoint.requestAnimationFrame(resizeHandler)
}})
}
Context.prototype.createThrottledScrollHandler=function(){
var self=this
function scrollHandler(){
self.handleScroll()
self.didScroll=false
}
this.adapter.on('scroll.waypoints', function(){
if(!self.didScroll||Waypoint.isTouch){
self.didScroll=true
Waypoint.requestAnimationFrame(scrollHandler)
}})
}
Context.prototype.handleResize=function(){
Waypoint.Context.refreshAll()
}
Context.prototype.handleScroll=function(){
var triggeredGroups={}
var axes={
horizontal: {
newScroll: this.adapter.scrollLeft(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left'
},
vertical: {
newScroll: this.adapter.scrollTop(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up'
}}
for (var axisKey in axes){
var axis=axes[axisKey]
var isForward=axis.newScroll > axis.oldScroll
var direction=isForward ? axis.forward:axis.backward
for (var waypointKey in this.waypoints[axisKey]){
var waypoint=this.waypoints[axisKey][waypointKey]
if(waypoint.triggerPoint===null){
continue
}
var wasBeforeTriggerPoint=axis.oldScroll < waypoint.triggerPoint
var nowAfterTriggerPoint=axis.newScroll >=waypoint.triggerPoint
var crossedForward=wasBeforeTriggerPoint&&nowAfterTriggerPoint
var crossedBackward = !wasBeforeTriggerPoint&&!nowAfterTriggerPoint
if(crossedForward||crossedBackward){
waypoint.queueTrigger(direction)
triggeredGroups[waypoint.group.id]=waypoint.group
}}
}
for (var groupKey in triggeredGroups){
triggeredGroups[groupKey].flushTriggers()
}
this.oldScroll={
x: axes.horizontal.newScroll,
y: axes.vertical.newScroll
}}
Context.prototype.innerHeight=function(){
if(this.element==this.element.window){
return Waypoint.viewportHeight()
}
return this.adapter.innerHeight()
}
Context.prototype.remove=function(waypoint){
delete this.waypoints[waypoint.axis][waypoint.key]
this.checkEmpty()
}
Context.prototype.innerWidth=function(){
if(this.element==this.element.window){
return Waypoint.viewportWidth()
}
return this.adapter.innerWidth()
}
Context.prototype.destroy=function(){
var allWaypoints=[]
for (var axis in this.waypoints){
for (var waypointKey in this.waypoints[axis]){
allWaypoints.push(this.waypoints[axis][waypointKey])
}}
for (var i=0, end=allWaypoints.length; i < end; i++){
allWaypoints[i].destroy()
}}
Context.prototype.refresh=function(){
var isWindow=this.element==this.element.window
var contextOffset=isWindow ? undefined:this.adapter.offset()
var triggeredGroups={}
var axes
this.handleScroll()
axes={
horizontal: {
contextOffset: isWindow ? 0:contextOffset.left,
contextScroll: isWindow ? 0:this.oldScroll.x,
contextDimension: this.innerWidth(),
oldScroll: this.oldScroll.x,
forward: 'right',
backward: 'left',
offsetProp: 'left'
},
vertical: {
contextOffset: isWindow ? 0:contextOffset.top,
contextScroll: isWindow ? 0:this.oldScroll.y,
contextDimension: this.innerHeight(),
oldScroll: this.oldScroll.y,
forward: 'down',
backward: 'up',
offsetProp: 'top'
}}
for (var axisKey in axes){
var axis=axes[axisKey]
for (var waypointKey in this.waypoints[axisKey]){
var waypoint=this.waypoints[axisKey][waypointKey]
var adjustment=waypoint.options.offset
var oldTriggerPoint=waypoint.triggerPoint
var elementOffset=0
var freshWaypoint=oldTriggerPoint==null
var contextModifier, wasBeforeScroll, nowAfterScroll
var triggeredBackward, triggeredForward
if(waypoint.element!==waypoint.element.window){
elementOffset=waypoint.adapter.offset()[axis.offsetProp]
}
if(typeof adjustment==='function'){
adjustment=adjustment.apply(waypoint)
}
else if(typeof adjustment==='string'){
adjustment=parseFloat(adjustment)
if(waypoint.options.offset.indexOf('%') > - 1){
adjustment=Math.ceil(axis.contextDimension * adjustment / 100)
}}
contextModifier=axis.contextScroll - axis.contextOffset
waypoint.triggerPoint=Math.floor(elementOffset + contextModifier - adjustment)
wasBeforeScroll=oldTriggerPoint < axis.oldScroll
nowAfterScroll=waypoint.triggerPoint >=axis.oldScroll
triggeredBackward=wasBeforeScroll&&nowAfterScroll
triggeredForward = !wasBeforeScroll&&!nowAfterScroll
if(!freshWaypoint&&triggeredBackward){
waypoint.queueTrigger(axis.backward)
triggeredGroups[waypoint.group.id]=waypoint.group
}
else if(!freshWaypoint&&triggeredForward){
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id]=waypoint.group
}
else if(freshWaypoint&&axis.oldScroll >=waypoint.triggerPoint){
waypoint.queueTrigger(axis.forward)
triggeredGroups[waypoint.group.id]=waypoint.group
}}
}
Waypoint.requestAnimationFrame(function(){
for (var groupKey in triggeredGroups){
triggeredGroups[groupKey].flushTriggers()
}})
return this
}
Context.findOrCreateByElement=function(element){
return Context.findByElement(element)||new Context(element)
}
Context.refreshAll=function(){
for (var contextId in contexts){
contexts[contextId].refresh()
}}
Context.findByElement=function(element){
return contexts[element.waypointContextKey]
}
window.onload=function(){
if(oldWindowLoad){
oldWindowLoad()
}
Context.refreshAll()
}
Waypoint.requestAnimationFrame=function(callback){
var requestFn=window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
requestAnimationFrameShim
requestFn.call(window, callback)
}
Waypoint.Context=Context
}())
;(function(){
'use strict'
function byTriggerPoint(a, b){
return a.triggerPoint - b.triggerPoint
}
function byReverseTriggerPoint(a, b){
return b.triggerPoint - a.triggerPoint
}
var groups={
vertical: {},
horizontal: {}}
var Waypoint=window.Waypoint
function Group(options){
this.name=options.name
this.axis=options.axis
this.id=this.name + '-' + this.axis
this.waypoints=[]
this.clearTriggerQueues()
groups[this.axis][this.name]=this
}
Group.prototype.add=function(waypoint){
this.waypoints.push(waypoint)
}
Group.prototype.clearTriggerQueues=function(){
this.triggerQueues={
up: [],
down: [],
left: [],
right: []
}}
Group.prototype.flushTriggers=function(){
for (var direction in this.triggerQueues){
var waypoints=this.triggerQueues[direction]
var reverse=direction==='up'||direction==='left'
waypoints.sort(reverse ? byReverseTriggerPoint:byTriggerPoint)
for (var i=0, end=waypoints.length; i < end; i +=1){
var waypoint=waypoints[i]
if(waypoint.options.continuous||i===waypoints.length - 1){
waypoint.trigger([direction])
}}
}
this.clearTriggerQueues()
}
Group.prototype.next=function(waypoint){
this.waypoints.sort(byTriggerPoint)
var index=Waypoint.Adapter.inArray(waypoint, this.waypoints)
var isLast=index===this.waypoints.length - 1
return isLast ? null:this.waypoints[index + 1]
}
Group.prototype.previous=function(waypoint){
this.waypoints.sort(byTriggerPoint)
var index=Waypoint.Adapter.inArray(waypoint, this.waypoints)
return index ? this.waypoints[index - 1]:null
}
Group.prototype.queueTrigger=function(waypoint, direction){
this.triggerQueues[direction].push(waypoint)
}
Group.prototype.remove=function(waypoint){
var index=Waypoint.Adapter.inArray(waypoint, this.waypoints)
if(index > -1){
this.waypoints.splice(index, 1)
}}
Group.prototype.first=function(){
return this.waypoints[0]
}
Group.prototype.last=function(){
return this.waypoints[this.waypoints.length - 1]
}
Group.findOrCreate=function(options){
return groups[options.axis][options.name]||new Group(options)
}
Waypoint.Group=Group
}())
;(function(){
'use strict'
var $=window.jQuery
var Waypoint=window.Waypoint
function JQueryAdapter(element){
this.$element=$(element)
}
$.each([
'innerHeight',
'innerWidth',
'off',
'offset',
'on',
'outerHeight',
'outerWidth',
'scrollLeft',
'scrollTop'
], function(i, method){
JQueryAdapter.prototype[method]=function(){
var args=Array.prototype.slice.call(arguments)
return this.$element[method].apply(this.$element, args)
}})
$.each([
'extend',
'inArray',
'isEmptyObject'
], function(i, method){
JQueryAdapter[method]=$[method]
})
Waypoint.adapters.push({
name: 'jquery',
Adapter: JQueryAdapter
})
Waypoint.Adapter=JQueryAdapter
}())
;(function(){
'use strict'
var Waypoint=window.Waypoint
function createExtension(framework){
return function(){
var waypoints=[]
var overrides=arguments[0]
if(framework.isFunction(arguments[0])){
overrides=framework.extend({}, arguments[1])
overrides.handler=arguments[0]
}
this.each(function(){
var options=framework.extend({}, overrides, {
element: this
})
if(typeof options.context==='string'){
options.context=framework(this).closest(options.context)[0]
}
waypoints.push(new Waypoint(options))
})
return waypoints
}}
if(window.jQuery){
window.jQuery.fn.waypoint=createExtension(window.jQuery)
}
if(window.Zepto){
window.Zepto.fn.waypoint=createExtension(window.Zepto)
}}())
;
(function(){
'use strict'
function noop(){}
var Waypoint=window.Waypoint
function Inview(options){
this.options=Waypoint.Adapter.extend({}, Inview.defaults, options)
this.axis=this.options.horizontal ? 'horizontal':'vertical'
this.waypoints=[]
this.element=this.options.element
this.createWaypoints()
}
Inview.prototype.createWaypoints=function(){
var configs={
vertical: [{
down: 'enter',
up: 'exited',
offset: '100%'
}, {
down: 'entered',
up: 'exit',
offset: 'bottom-in-view'
}, {
down: 'exit',
up: 'entered',
offset: 0
}, {
down: 'exited',
up: 'enter',
offset: function(){
return -this.adapter.outerHeight()
}}],
horizontal: [{
right: 'enter',
left: 'exited',
offset: '100%'
}, {
right: 'entered',
left: 'exit',
offset: 'right-in-view'
}, {
right: 'exit',
left: 'entered',
offset: 0
}, {
right: 'exited',
left: 'enter',
offset: function(){
return -this.adapter.outerWidth()
}}]
}
for (var i=0, end=configs[this.axis].length; i < end; i++){
var config=configs[this.axis][i]
this.createWaypoint(config)
}}
Inview.prototype.createWaypoint=function(config){
var self=this
this.waypoints.push(new Waypoint({
context: this.options.context,
element: this.options.element,
enabled: this.options.enabled,
handler: (function(config){
return function(direction){
self.options[config[direction]].call(self, direction)
}}(config)),
offset: config.offset,
horizontal: this.options.horizontal
}))
}
Inview.prototype.destroy=function(){
for (var i=0, end=this.waypoints.length; i < end; i++){
this.waypoints[i].destroy()
}
this.waypoints=[]
}
Inview.prototype.disable=function(){
for (var i=0, end=this.waypoints.length; i < end; i++){
this.waypoints[i].disable()
}}
Inview.prototype.enable=function(){
for (var i=0, end=this.waypoints.length; i < end; i++){
this.waypoints[i].enable()
}}
Inview.defaults={
context: window,
enabled: true,
enter: noop,
entered: noop,
exit: noop,
exited: noop
}
Waypoint.Inview=Inview
}())
;
(function($){
var menuTrees=[],
IE = !!window.createPopup,
IElt9=IE&&!document.defaultView,
IElt8=IE&&!document.querySelector,
IE6=IE&&typeof document.documentElement.currentStyle.minWidth=='undefined',
mouse=false,
mouseDetectionEnabled=false;
function initMouseDetection(disable){
if(!mouseDetectionEnabled&&!disable){
var firstTime=true,
lastMove=null;
$(document).bind({
'mousemove.smartmenus_mouse': function(e){
var thisMove={ x: e.pageX, y: e.pageY, timeStamp: new Date().getTime() };
if(lastMove){
var deltaX=Math.abs(lastMove.x - thisMove.x),
deltaY=Math.abs(lastMove.y - thisMove.y);
if((deltaX > 0||deltaY > 0)&&deltaX <=2&&deltaY <=2&&thisMove.timeStamp - lastMove.timeStamp <=300){
mouse=true;
if(firstTime){
var $a=$(e.target).closest('a');
if($a.is('a')){
$.each(menuTrees, function(){
if($.contains(this.$root[0], $a[0])){
this.itemEnter({ currentTarget: $a[0] });
return false;
}});
}
firstTime=false;
}}
}
lastMove=thisMove;
},
'touchstart.smartmenus_mouse pointerover.smartmenus_mouse MSPointerOver.smartmenus_mouse': function(e){
if(!/^(4|mouse)$/.test(e.originalEvent.pointerType)){
mouse=false;
}}
});
mouseDetectionEnabled=true;
}else if(mouseDetectionEnabled&&disable){
$(document).unbind('.smartmenus_mouse');
mouseDetectionEnabled=false;
}};
$.SmartMenus=function(elm, options){
this.$root=$(elm);
this.opts=options;
this.rootId='';
this.$subArrow=null;
this.subMenus=[];
this.activatedItems=[];
this.visibleSubMenus=[];
this.showTimeout=0;
this.hideTimeout=0;
this.scrollTimeout=0;
this.clickActivated=false;
this.zIndexInc=0;
this.$firstLink=null;
this.$firstSub=null;
this.disabled=false;
this.$disableOverlay=null;
this.init();
};
$.extend($.SmartMenus, {
hideAll: function(){
$.each(menuTrees, function(){
this.menuHideAll();
});
},
destroy: function(){
while (menuTrees.length){
menuTrees[0].destroy();
}
initMouseDetection(true);
},
prototype: {
init: function(refresh){
var self=this;
if(!refresh){
menuTrees.push(this);
this.rootId=(new Date().getTime() + Math.random() + '').replace(/\D/g, '');
if(this.$root.hasClass('sm-rtl')){
this.opts.rightToLeftSubMenus=true;
}
this.$root
.data('smartmenus', this)
.attr('data-smartmenus-id', this.rootId)
.dataSM('level', 1)
.bind({
'mouseover.smartmenus focusin.smartmenus': $.proxy(this.rootOver, this),
'mouseout.smartmenus focusout.smartmenus': $.proxy(this.rootOut, this)
})
.delegate('a', {
'mouseenter.smartmenus': $.proxy(this.itemEnter, this),
'mouseleave.smartmenus': $.proxy(this.itemLeave, this),
'mousedown.smartmenus': $.proxy(this.itemDown, this),
'focus.smartmenus': $.proxy(this.itemFocus, this),
'blur.smartmenus': $.proxy(this.itemBlur, this),
'click.smartmenus': $.proxy(this.itemClick, this),
'touchend.smartmenus': $.proxy(this.itemTouchEnd, this)
});
var eNamespace='.smartmenus' + this.rootId;
if(this.opts.hideOnClick){
$(document).bind('touchstart' + eNamespace, $.proxy(this.docTouchStart, this))
.bind('touchmove' + eNamespace, $.proxy(this.docTouchMove, this))
.bind('touchend' + eNamespace, $.proxy(this.docTouchEnd, this))
.bind('click' + eNamespace, $.proxy(this.docClick, this));
}
$(window).bind('resize' + eNamespace + ' orientationchange' + eNamespace, $.proxy(this.winResize, this));
$(window).bind('scroll' + eNamespace + ' orientationchange' + eNamespace, $.proxy(this.winResize, this));
if(this.opts.subIndicators){
this.$subArrow=$(' ').addClass('sub-arrow');
if(this.opts.subIndicatorsText){
this.$subArrow.html(this.opts.subIndicatorsText);
}}
initMouseDetection();
}
this.$firstSub=this.$root.find('ul').each(function(){ self.menuInit($(this)); }).eq(0);
this.$firstLink=this.$root.find('a').eq(0);
if(this.opts.markCurrentItem){
var reDefaultDoc=/(index|default)\.[^#\?\/]*/i,
reHash=/#.*/,
locHref=window.location.href.replace(reDefaultDoc, ''),
locHrefNoHash=locHref.replace(reHash, '');
this.$root.find('a').each(function(){
var href=this.href.replace(reDefaultDoc, ''),
$this=$(this);
if(href==locHref||href==locHrefNoHash){
$this.addClass('current');
if(self.opts.markCurrentTree){
$this.parents('li').each(function(){
var $this=$(this);
if($this.dataSM('sub')){
$this.children('a').addClass('current');
}});
}}
});
}},
destroy: function(){
this.menuHideAll();
this.$root
.removeData('smartmenus')
.removeAttr('data-smartmenus-id')
.removeDataSM('level')
.unbind('.smartmenus')
.undelegate('.smartmenus');
var eNamespace='.smartmenus' + this.rootId;
$(document).unbind(eNamespace);
$(window).unbind(eNamespace);
if(this.opts.subIndicators){
this.$subArrow=null;
}
var self=this;
$.each(this.subMenus, function(){
if(this.hasClass('mega-menu')){
this.find('ul').removeDataSM('in-mega');
}
if(this.dataSM('shown-before')){
if(IElt8){
this.children().css({ styleFloat: '', width: '' });
}
if(self.opts.subMenusMinWidth||self.opts.subMenusMaxWidth){
if(!IE6){
this.css({ width: '', minWidth: '', maxWidth: '' }).removeClass('sm-nowrap');
}else{
this.css({ width: '', overflowX: '', overflowY: '' }).children().children('a').css('white-space', '');
}}
if(this.dataSM('scroll-arrows')){
this.dataSM('scroll-arrows').remove();
}
this.css({ zIndex: '', top: '', left: '', marginLeft: '', marginTop: '', display: '' });
}
if(self.opts.subIndicators){
this.dataSM('parent-a').removeClass('has-submenu').children('span.sub-arrow').remove();
}
this.removeDataSM('shown-before')
.removeDataSM('ie-shim')
.removeDataSM('scroll-arrows')
.removeDataSM('parent-a')
.removeDataSM('level')
.removeDataSM('beforefirstshowfired')
.parent().removeDataSM('sub');
});
if(this.opts.markCurrentItem){
this.$root.find('a.current').removeClass('current');
}
this.$root=null;
this.$firstLink=null;
this.$firstSub=null;
if(this.$disableOverlay){
this.$disableOverlay.remove();
this.$disableOverlay=null;
}
menuTrees.splice($.inArray(this, menuTrees), 1);
},
disable: function(noOverlay){
if(!this.disabled){
this.menuHideAll();
if(!noOverlay&&!this.opts.isPopup&&this.$root.is(':visible')){
var pos=this.$root.offset();
this.$disableOverlay=$('
').css({
position: 'absolute',
top: pos.top,
left: pos.left,
width: this.$root.outerWidth(),
height: this.$root.outerHeight(),
zIndex: this.getStartZIndex() + 1,
opacity: 0
}).appendTo(document.body);
}
this.disabled=true;
}},
docClick: function(e){
if(this.visibleSubMenus.length&&!$.contains(this.$root[0], e.target)||$(e.target).is('a')){
this.menuHideAll($(e.target));
}},
docTouchEnd: function(e){
if(!this.lastTouch){
return;
}
if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!$.contains(this.$root[0], this.lastTouch.target))){
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
var self=this;
this.hideTimeout=setTimeout(function(){ self.menuHideAll($(e.target)); }, 350);
}
this.lastTouch=null;
},
docTouchMove: function(e){
if(!this.lastTouch){
return;
}
var touchPoint=e.originalEvent.touches[0];
this.lastTouch.x2=touchPoint.pageX;
this.lastTouch.y2=touchPoint.pageY;
},
docTouchStart: function(e){
var touchPoint=e.originalEvent.touches[0];
this.lastTouch={ x1: touchPoint.pageX, y1: touchPoint.pageY, target: touchPoint.target };},
enable: function(){
if(this.disabled){
if(this.$disableOverlay){
this.$disableOverlay.remove();
this.$disableOverlay=null;
}
this.disabled=false;
}},
getHeight: function($elm){
return this.getOffset($elm, true);
},
getOffset: function($elm, height){
var old;
if($elm.css('display')=='none'){
old={ position: $elm[0].style.position, visibility: $elm[0].style.visibility };
$elm.css({ position: 'absolute', visibility: 'hidden' }).show();
}
var defaultView=$elm[0].ownerDocument.defaultView,
compStyle=defaultView&&defaultView.getComputedStyle&&defaultView.getComputedStyle($elm[0], null),
val=compStyle&&parseFloat(compStyle[height ? 'height':'width']);
if(val){
val +=parseFloat(compStyle[height ? 'paddingTop':'paddingLeft'])
+ parseFloat(compStyle[height ? 'paddingBottom':'paddingRight'])
+ parseInt(compStyle[height ? 'borderTopWidth':'borderLeftWidth'])
+ parseInt(compStyle[height ? 'borderBottomWidth':'borderRightWidth']);
}else{
val=height ? $elm[0].offsetHeight:$elm[0].offsetWidth;
}
if(old){
$elm.hide().css(old);
}
return val;
},
getWidth: function($elm){
return this.getOffset($elm);
},
getStartZIndex: function(){
var zIndex=parseInt(this.$root.css('z-index'));
return !isNaN(zIndex) ? zIndex:1;
},
handleEvents: function(){
return !this.disabled&&this.isCSSOn();
},
handleItemEvents: function($a){
return this.handleEvents()&&!this.isLinkInMegaMenu($a);
},
isCollapsible: function(){
return this.$firstSub.css('position')=='static';
},
isCSSOn: function(){
return this.$firstLink.css('display')=='block'||this.$firstLink.css('display')=='inline';
},
isFixed: function(){
return this.$root.css('position')=='fixed';
},
isLinkInMegaMenu: function($a){
return !$a.parent().parent().dataSM('level');
},
isTouchMode: function(){
return !mouse||this.isCollapsible();
},
itemActivate: function($a){
var $li=$a.parent(),
$ul=$li.parent(),
level=$ul.dataSM('level');
if(level > 1&&(!this.activatedItems[level - 2]||this.activatedItems[level - 2][0]!=$ul.dataSM('parent-a')[0])){
var self=this;
$($ul.parentsUntil('[data-smartmenus-id]', 'ul').get().reverse()).add($ul).each(function(){
self.itemActivate($(this).dataSM('parent-a'));
});
}
if(this.visibleSubMenus.length > level){
for (var i=this.visibleSubMenus.length - 1, l = !this.activatedItems[level - 1]||this.activatedItems[level - 1][0]!=$a[0] ? level - 1:level; i > l; i--){
this.menuHide(this.visibleSubMenus[i]);
}}
this.activatedItems[level - 1]=$a;
this.visibleSubMenus[level - 1]=$ul;
if(this.$root.triggerHandler('activate.smapi', $a[0])===false){
return;
}
var $sub=$li.dataSM('sub');
if($sub&&(this.isTouchMode()||(!this.opts.showOnClick||this.clickActivated))){
this.menuShow($sub);
}},
itemBlur: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
this.$root.triggerHandler('blur.smapi', $a[0]);
},
itemClick: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
$a.removeDataSM('mousedown');
if(this.$root.triggerHandler('click.smapi', $a[0])===false){
return false;
}
var $sub=$a.parent().dataSM('sub');
if(this.isTouchMode()){
if($a.dataSM('href')){
$a.attr('href', $a.dataSM('href')).removeDataSM('href');
}
if($sub&&(!$sub.dataSM('shown-before')||!$sub.is(':visible'))){
this.itemActivate($a);
if($sub.is(':visible')){
return false;
}}
}else if(this.opts.showOnClick&&$a.parent().parent().dataSM('level')==1&&$sub){
this.clickActivated=true;
this.menuShow($sub);
return false;
}
if($a.hasClass('disabled')){
return false;
}
if(this.$root.triggerHandler('select.smapi', $a[0])===false){
return false;
}},
itemDown: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
$a.dataSM('mousedown', true);
},
itemEnter: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
if(!this.isTouchMode()){
if(this.showTimeout){
clearTimeout(this.showTimeout);
this.showTimeout=0;
}
var self=this;
this.showTimeout=setTimeout(function(){ self.itemActivate($a); }, this.opts.showOnClick&&$a.parent().parent().dataSM('level')==1 ? 1:this.opts.showTimeout);
}
this.$root.triggerHandler('mouseenter.smapi', $a[0]);
},
itemFocus: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
if((!this.isTouchMode()||!$a.dataSM('mousedown'))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length - 1][0]!=$a[0])){
this.itemActivate($a);
}
this.$root.triggerHandler('focus.smapi', $a[0]);
},
itemLeave: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
if(!this.isTouchMode()){
if($a[0].blur){
$a[0].blur();
}
if(this.showTimeout){
clearTimeout(this.showTimeout);
this.showTimeout=0;
}}
$a.removeDataSM('mousedown');
this.$root.triggerHandler('mouseleave.smapi', $a[0]);
},
itemTouchEnd: function(e){
var $a=$(e.currentTarget);
if(!this.handleItemEvents($a)){
return;
}
var $sub=$a.parent().dataSM('sub');
if($a.attr('href').charAt(0)!=='#'&&$sub&&(!$sub.dataSM('shown-before')||!$sub.is(':visible'))){
$a.dataSM('href', $a.attr('href'));
$a.attr('href', '#');
}},
menuFixLayout: function($ul){
if(!$ul.dataSM('shown-before')){
$ul.hide().dataSM('shown-before', true);
if(IElt8){
$ul.children().css({ styleFloat: 'left', width: '100%' });
}}
},
menuHide: function($sub){
if(this.$root.triggerHandler('beforehide.smapi', $sub[0])===false){
return;
}
$sub.stop(true, true);
if($sub.is(':visible')){
var complete=function(){
if(IElt9){
$sub.parent().css('z-index', '');
}else{
$sub.css('z-index', '');
}};
if(this.isCollapsible()){
if(this.opts.collapsibleHideFunction){
this.opts.collapsibleHideFunction.call(this, $sub, complete);
}else{
$sub.hide(this.opts.collapsibleHideDuration, complete);
}}else{
if(this.opts.hideFunction){
this.opts.hideFunction.call(this, $sub, complete);
}else{
$sub.hide(this.opts.hideDuration, complete);
}}
if($sub.dataSM('ie-shim')){
$sub.dataSM('ie-shim').remove();
}
if($sub.dataSM('scroll')){
$sub.unbind('.smartmenus_scroll').removeDataSM('scroll').dataSM('scroll-arrows').hide();
}
$sub.dataSM('parent-a').removeClass('highlighted');
var level=$sub.dataSM('level');
this.activatedItems.splice(level - 1, 1);
this.visibleSubMenus.splice(level - 1, 1);
this.$root.triggerHandler('hide.smapi', $sub[0]);
}},
menuHideAll: function($item){
if($item!=undefined&&$item.parent().hasClass('menu-item')&&!$item.parent().hasClass('menu-item-has-children')) return;
if($('body').hasClass('vmenu')) return;
if(this.showTimeout){
clearTimeout(this.showTimeout);
this.showTimeout=0;
}
for (var i=this.visibleSubMenus.length - 1; i > 0; i--){
this.menuHide(this.visibleSubMenus[i]);
}
if(this.opts.isPopup){
this.$root.stop(true, true);
if(this.$root.is(':visible')){
if(this.opts.hideFunction){
this.opts.hideFunction.call(this, this.$root);
}else{
this.$root.hide(this.opts.hideDuration);
}
if(this.$root.dataSM('ie-shim')){
this.$root.dataSM('ie-shim').remove();
}}
}
this.activatedItems=[];
this.visibleSubMenus=[];
this.clickActivated=false;
this.zIndexInc=0;
},
menuIframeShim: function($ul){
if(IE&&this.opts.overlapControlsInIE&&!$ul.dataSM('ie-shim')){
$ul.dataSM('ie-shim', $('').attr({ src: 'javascript:0', tabindex: -9 })
.css({ position: 'absolute', top: 'auto', left: '0', opacity: 0, border: '0' })
);
}},
menuInit: function($ul){
if(!$ul.dataSM('in-mega')){
this.subMenus.push($ul);
if($ul.hasClass('mega-menu')){
$ul.find('ul').dataSM('in-mega', true);
}
var level=2,
par=$ul[0];
while ((par=par.parentNode.parentNode)!=this.$root[0]){
level++;
}
$ul.dataSM('parent-a', $ul.prevAll('a').eq(-1))
.dataSM('level', level)
.parent().dataSM('sub', $ul);
if(this.opts.subIndicators){
$ul.dataSM('parent-a').addClass('has-submenu')[this.opts.subIndicatorsPos](this.$subArrow.clone());
}}
},
menuPosition: function($sub){
var fixIE=$('html.ie').length;
var $a=$sub.dataSM('parent-a'),
$li=$sub.parent(),
$ul=$sub.parent().parent(),
$container=$ul.closest('.row-menu-inner'),
level=$sub.dataSM('level'),
subW=this.getWidth($sub),
subH=this.getHeight($sub),
itemOffset=$a.offset(),
itemX=itemOffset.left,
itemY=itemOffset.top,
itemW=this.getWidth($a),
itemH=this.getHeight($a),
$win=$(window),
winX=$win.scrollLeft(),
winY=$win.scrollTop(),
winW=$win.width(),
winH=$win.height(),
containerW=$container.width(),
containerOffsetX=containerW + ((winW - containerW) / 2),
horizontalParent=$ul.hasClass('sm')&&!$ul.hasClass('sm-vertical'),
subOffsetX=level==2 ? this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,
subOffsetY=level==2 ? this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY,
x, y, leftPos;
if(horizontalParent){
x=this.opts.rightToLeftSubMenus ? itemW - subW - subOffsetX:subOffsetX;
y=this.opts.bottomToTopSubMenus ? -subH - subOffsetY:itemH + subOffsetY;
}else{
x=this.opts.rightToLeftSubMenus ? subOffsetX - subW:itemW - subOffsetX;
y=this.opts.bottomToTopSubMenus ? itemH - subOffsetY - subH:subOffsetY;
}
if(this.opts.keepInViewport&&!this.isCollapsible()){
if(this.isFixed()){
itemX -=winX;
itemY -=winY;
winX=winY=0;
}
var absX=itemX + x,
absY=itemY + y;
if(this.opts.rightToLeftSubMenus&&absX < winX){
x=horizontalParent ? winX - absX + x:itemW - subOffsetX;
}else if(!this.opts.rightToLeftSubMenus&&absX + subW > winX + containerOffsetX){
x=horizontalParent ? winX + containerOffsetX - subW - absX + x:subOffsetX - subW;
}
if(!horizontalParent){
if(subH < winH&&absY + subH > winY + winH){
y +=winY + winH - subH - absY;
}else if(subH >=winH||absY < winY){
y +=winY - absY;
}}
if(mouse&&(horizontalParent&&(absY + subH > winY + winH + 0.49||absY < winY)||!horizontalParent&&subH > winH + 0.49)){
var self=this;
if(!$sub.dataSM('scroll-arrows')){
$sub.dataSM('scroll-arrows', $([$(' ')[0], $(' ')[0]])
.bind({
mouseenter: function(){ self.menuScroll($sub, $(this).hasClass('scroll-up')); },
mouseleave: function(e){
self.menuScrollStop($sub);
self.menuScrollOut($sub, e);
},
'mousewheel DOMMouseScroll': function(e){ e.preventDefault(); }})
.insertAfter($sub)
);
}
var vportY=winY - (itemY + itemH);
$sub.dataSM('scroll', {
vportY: vportY,
subH: subH,
winH: winH,
step: 1
})
.bind({
'mouseover.smartmenus_scroll': function(e){ self.menuScrollOver($sub, e); },
'mouseout.smartmenus_scroll': function(e){ self.menuScrollOut($sub, e); },
'mousewheel.smartmenus_scroll DOMMouseScroll.smartmenus_scroll': function(e){ self.menuScrollMousewheel($sub, e); }})
.dataSM('scroll-arrows').css({ top: 'auto', left: '0', marginLeft: x + (parseInt($sub.css('border-left-width'))||0), width: this.getWidth($sub) - (parseInt($sub.css('border-left-width'))||0) - (parseInt($sub.css('border-right-width'))||0), zIndex: this.getStartZIndex() + this.zIndexInc })
.eq(0).css('margin-top', vportY).end()
.eq(1).css('margin-top', vportY + winH - this.getHeight($sub.dataSM('scroll-arrows').eq(1))).end()
.eq(horizontalParent&&this.opts.bottomToTopSubMenus ? 0:1).show();
}}
if($sub.hasClass('mega-menu-inner')){
$sub.css({ width: containerW});
if($('body.hmenu-center-double').length){
leftPos='0px';
}else{
if($('body.hmenu-center-split').length > 0&&!$sub.closest('.navbar-cta').length&&! $('body.hormenu-position-right').length){
leftPos=- ($sub.closest('.menu-primary-inner')[0].offsetLeft) + 'px';
}else{
if($sub.closest('.navbar-cta').length&&!$('body.hmenu').length&&!$('body.hmenu-center').length){
leftPos=-(parseFloat($sub.closest('.navbar-cta').offset().left) - parseFloat($sub.closest('.row-menu-inner').find('.logo-container').offset().left)) + 'px';
}else if($sub.closest('.row-menu-inner').find('.logo-container').length > 0&&!$('body.hmenu-center-split').length){
leftPos=- (parseFloat($sub.closest('.row-menu-inner').find('.logo-container').css('paddingRight')) + ($sub.closest('.row-menu-inner').find('.logo-container').width())) + 'px';
}else{
leftPos='0px';
}}
}}else{
leftPos=(level > 2 ? $li.position().left - parseFloat($li.closest('ul').css('paddingLeft')):$li.position().left) + 'px';
x=(level > 2&&x >=0) ? x + (parseFloat($li.closest('ul').css('paddingLeft')) * 2) + 1:x - 1;
}
$sub.css({ top: (level > 2) ? $a[0].offsetTop:(fixIE ? itemH:'100%'), left: leftPos, marginLeft: x, marginTop: (level > 2) ? 0:y - itemH + ($sub.closest('.menu-mini').length ? 0:1) });
this.menuIframeShim($sub);
if($sub.dataSM('ie-shim')){
$sub.dataSM('ie-shim').css({ zIndex: $sub.css('z-index'), width: subW, height: subH, marginLeft: x, marginTop: y - itemH + ($sub.closest('.menu-mini').length ? 0:1) });
}},
menuScroll: function($sub, up, wheel){
var y=parseFloat($sub.css('margin-top')),
scroll=$sub.dataSM('scroll'),
end=scroll.vportY + (up ? 0:scroll.winH - scroll.subH),
step=wheel||!this.opts.scrollAccelerate ? this.opts.scrollStep:Math.floor($sub.dataSM('scroll').step);
$sub.add($sub.dataSM('ie-shim')).css('margin-top', Math.abs(end - y) > step ? y + (up ? step:-step):end);
y=parseFloat($sub.css('margin-top'));
if(up&&y + scroll.subH > scroll.vportY + scroll.winH||!up&&y < scroll.vportY){
$sub.dataSM('scroll-arrows').eq(up ? 1:0).show();
}
if(!wheel&&this.opts.scrollAccelerate&&$sub.dataSM('scroll').step < this.opts.scrollStep){
$sub.dataSM('scroll').step +=0.5;
}
if(Math.abs(y - end) < 1){
$sub.dataSM('scroll-arrows').eq(up ? 0:1).hide();
$sub.dataSM('scroll').step=1;
}else if(!wheel){
var self=this;
this.scrollTimeout=setTimeout(function(){ self.menuScroll($sub, up); }, this.opts.scrollInterval);
}},
menuScrollMousewheel: function($sub, e){
var $closestSub=$(e.target).closest('ul');
while ($closestSub.dataSM('in-mega')){
$closestSub=$closestSub.parent().closest('ul');
}
if($closestSub[0]==$sub[0]){
var up=(e.originalEvent.wheelDelta||-e.originalEvent.detail) > 0;
if($sub.dataSM('scroll-arrows').eq(up ? 0:1).is(':visible')){
this.menuScroll($sub, up, true);
}}
e.preventDefault();
},
menuScrollOut: function($sub, e){
var reClass=/^scroll-(up|down)/,
$closestSub=$(e.relatedTarget).closest('ul');
while ($closestSub.dataSM('in-mega')){
$closestSub=$closestSub.parent().closest('ul');
}
if(!reClass.test((e.relatedTarget||'').className)&&($sub[0]!=e.relatedTarget&&!$.contains($sub[0], e.relatedTarget)||$closestSub[0]!=$sub[0])){
$sub.dataSM('scroll-arrows').css('visibility', 'hidden');
}},
menuScrollOver: function($sub, e){
var reClass=/^scroll-(up|down)/,
$closestSub=$(e.target).closest('ul');
while ($closestSub.dataSM('in-mega')){
$closestSub=$closestSub.parent().closest('ul');
}
if(!reClass.test(e.target.className)&&$closestSub[0]==$sub[0]){
$sub.dataSM('scroll-arrows').css('visibility', 'visible');
}},
menuScrollStop: function($sub){
if(this.scrollTimeout){
clearTimeout(this.scrollTimeout);
this.scrollTimeout=0;
$sub.dataSM('scroll').step=1;
}},
menuShow: function($sub){
if(!$sub.dataSM('beforefirstshowfired')){
$sub.dataSM('beforefirstshowfired', true);
if(this.$root.triggerHandler('beforefirstshow.smapi', $sub[0])===false){
return;
}}
if(this.$root.triggerHandler('beforeshow.smapi', $sub[0])===false){
return;
}
this.menuFixLayout($sub);
$sub.stop(true, true);
if(!$sub.is(':visible')){
var zIndex=this.getStartZIndex() + (++this.zIndexInc);
if(IElt9){
$sub.parent().css('z-index', zIndex);
}else{
$sub.css('z-index', zIndex);
}
if(this.opts.keepHighlighted||this.isCollapsible()){
if($sub.dataSM('parent-a').attr('data-type')!='title')
$sub.dataSM('parent-a').addClass('highlighted');
}
if(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth){
if(!IElt8){
$sub.css({ width: ($sub.hasClass('mega-menu-inner')) ? $('.box-container').outerWidth() + 'px':'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap');
if(this.opts.subMenusMinWidth){
$sub.css('min-width', this.opts.subMenusMinWidth);
}
if(this.opts.subMenusMaxWidth){
var noMaxWidth=this.getWidth($sub);
$sub.css('max-width', this.opts.subMenusMaxWidth);
if(noMaxWidth > this.getWidth($sub)){
$sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth);
}}
}else{
$sub.children().css('styleFloat', 'none');
if(IE6){
$sub.width(this.opts.subMenusMinWidth ? this.opts.subMenusMinWidth:1)
.children().children('a').css('white-space', 'nowrap');
}else{
$sub.css({ width: ($sub.hasClass('mega-menu-inner')) ? $('.box-container').outerWidth() + 'px':'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap');
if(this.opts.subMenusMinWidth){
$sub.css('min-width', this.opts.subMenusMinWidth);
}}
if(this.opts.subMenusMaxWidth){
var noMaxWidth=$sub.width();
if(IE6){
var maxWidth=$sub.css({ width: this.opts.subMenusMaxWidth, overflowX: 'hidden', overflowY: 'hidden' }).width();
if(noMaxWidth > maxWidth){
$sub.css({ width: maxWidth, overflowX: 'visible', overflowY: 'visible' }).children().children('a').css('white-space', '');
}else{
$sub.css({ width: noMaxWidth, overflowX: 'visible', overflowY: 'visible' });
}}else{
$sub.css('max-width', this.opts.subMenusMaxWidth);
if(noMaxWidth > $sub.width()){
$sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth);
}else{
$sub.width(noMaxWidth);
}}
}else{
$sub.width($sub.width());
}
$sub.children().css('styleFloat', 'left');
}}
this.menuPosition($sub);
if($sub.dataSM('ie-shim')){
$sub.dataSM('ie-shim').insertBefore($sub);
}
var complete=function(){
$sub.css('overflow', '');
};
if(this.isCollapsible()){
if(this.opts.collapsibleShowFunction){
this.opts.collapsibleShowFunction.call(this, $sub, complete);
}else{
$sub.show(this.opts.collapsibleShowDuration, complete);
}}else{
if(this.opts.showFunction){
this.opts.showFunction.call(this, $sub, complete);
}else{
$sub.show(this.opts.showDuration, complete);
}}
this.visibleSubMenus[$sub.dataSM('level') - 1]=$sub;
this.$root.triggerHandler('show.smapi', $sub[0]);
}},
popupHide: function(noHideTimeout){
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
var self=this;
this.hideTimeout=setTimeout(function(){
self.menuHideAll();
}, noHideTimeout ? 1:this.opts.hideTimeout);
},
popupShow: function(left, top){
if(!this.opts.isPopup){
alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');
return;
}
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
this.menuFixLayout(this.$root);
this.$root.stop(true, true);
if(!this.$root.is(':visible')){
this.$root.css({ left: left, top: top });
this.menuIframeShim(this.$root);
if(this.$root.dataSM('ie-shim')){
this.$root.dataSM('ie-shim').css({ zIndex: this.$root.css('z-index'), width: this.getWidth(this.$root), height: this.getHeight(this.$root), left: left, top: top }).insertBefore(this.$root);
}
if(this.opts.showFunction){
this.opts.showFunction.call(this, this.$root);
}else{
this.$root.show(this.opts.showDuration);
}
this.visibleSubMenus[0]=this.$root;
}},
refresh: function(){
this.menuHideAll();
this.$root.find('ul').each(function(){
var $this=$(this);
if($this.dataSM('scroll-arrows')){
$this.dataSM('scroll-arrows').remove();
}})
.removeDataSM('in-mega')
.removeDataSM('shown-before')
.removeDataSM('ie-shim')
.removeDataSM('scroll-arrows')
.removeDataSM('parent-a')
.removeDataSM('level')
.removeDataSM('beforefirstshowfired');
this.$root.find('a.has-submenu').removeClass('has-submenu')
.parent().removeDataSM('sub');
if(this.opts.subIndicators){
this.$root.find('span.sub-arrow').remove();
}
if(this.opts.markCurrentItem){
this.$root.find('a.current').removeClass('current');
}
this.subMenus=[];
this.init(true);
},
rootOut: function(e){
if(!this.handleEvents()||this.isTouchMode()||e.target==this.$root[0]){
return;
}
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}
if(!this.opts.showOnClick||!this.opts.hideOnClick){
var self=this;
this.hideTimeout=setTimeout(function(){ self.menuHideAll(); }, this.opts.hideTimeout);
}},
rootOver: function(e){
if(!this.handleEvents()||this.isTouchMode()||e.target==this.$root[0]){
return;
}
if(this.hideTimeout){
clearTimeout(this.hideTimeout);
this.hideTimeout=0;
}},
winResize: function(e){
if(!this.handleEvents()){
if(this.$disableOverlay){
var pos=this.$root.offset();
this.$disableOverlay.css({
top: pos.top,
left: pos.left,
width: this.$root.outerWidth(),
height: this.$root.outerHeight()
});
}
return;
}
if(!this.isCollapsible()&&(!('onorientationchange' in window)||e.type=='orientationchange')){
if(this.activatedItems.length){
this.activatedItems[this.activatedItems.length - 1][0].blur();
}
this.menuHideAll();
}}
}});
$.fn.dataSM=function(key, val){
if(val){
return this.data(key + '_smartmenus', val);
}
return this.data(key + '_smartmenus');
}
$.fn.removeDataSM=function(key){
return this.removeData(key + '_smartmenus');
}
$.fn.smartmenus=function(options){
if(typeof options=='string'){
var args=arguments,
method=options;
Array.prototype.shift.call(args);
return this.each(function(){
var smartmenus=$(this).data('smartmenus');
if(smartmenus&&smartmenus[method]){
smartmenus[method].apply(smartmenus, args);
}});
}
var opts=$.extend({}, $.fn.smartmenus.defaults, options);
return this.each(function(){
new $.SmartMenus(this, opts);
});
}
$.fn.smartmenus.defaults={
isPopup: false,
mainMenuSubOffsetX: 0,
mainMenuSubOffsetY: 0,
subMenusSubOffsetX: 0,
subMenusSubOffsetY: 0,
subMenusMinWidth: '10em',
subMenusMaxWidth: '20em',
subIndicators: true,
subIndicatorsPos: 'prepend',
subIndicatorsText: '+',
scrollStep: 30,
scrollInterval: 30,
scrollAccelerate: true,
showTimeout: 250,
hideTimeout: 500,
showDuration: 0,
showFunction: null,
hideDuration: 0,
hideFunction: function($ul, complete){ $ul.fadeOut(200, complete); },
collapsibleShowDuration:0,
collapsibleShowFunction:function($ul, complete){ $ul.slideDown(200, complete); },
collapsibleHideDuration:0,
collapsibleHideFunction:function($ul, complete){ $ul.slideUp(200, complete); },
showOnClick: false,
hideOnClick: true,
keepInViewport: true,
keepHighlighted: true,
markCurrentItem: false,
markCurrentTree: true,
rightToLeftSubMenus: false,
bottomToTopSubMenus: false,
overlapControlsInIE: true
};})(jQuery);
jQuery.easing['jswing']=jQuery.easing['swing'];
jQuery.extend(jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d){
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d){
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d){
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d){
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d){
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d){
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d){
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d){
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d){
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d){
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d){
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d){
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d){
return (t==0) ? b:c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d){
return (t==d) ? b+c:c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d){
if(t==0) return b;
if(t==d) return b+c;
if((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d){
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d){
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d){
if((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d){
var s=1.70158;var p=0;var a=c;
if(t==0) return b; if((t/=d)==1) return b+c; if(!p) p=d*.3;
if(a < Math.abs(c)){ a=c; var s=p/4; }
else var s=p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p)) + b;
},
easeOutElastic: function (x, t, b, c, d){
var s=1.70158;var p=0;var a=c;
if(t==0) return b; if((t/=d)==1) return b+c; if(!p) p=d*.3;
if(a < Math.abs(c)){ a=c; var s=p/4; }
else var s=p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin((t*d-s)*(2*Math.PI)/p) + c + b;
},
easeInOutElastic: function (x, t, b, c, d){
var s=1.70158;var p=0;var a=c;
if(t==0) return b; if((t/=d/2)==2) return b+c; if(!p) p=d*(.3*1.5);
if(a < Math.abs(c)){ a=c; var s=p/4; }
else var s=p/(2*Math.PI) * Math.asin (c/a);
if(t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p)) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin((t*d-s)*(2*Math.PI)/p)*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s){
if(s==undefined) s=1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s){
if(s==undefined) s=1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s){
if(s==undefined) s=1.70158;
if((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d){
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d){
if((t/=d) < (1/2.75)){
return c*(7.5625*t*t) + b;
}else if(t < (2/2.75)){
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
}else if(t < (2.5/2.75)){
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
}else{
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}},
easeInOutBounce: function (x, t, b, c, d){
if(t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}});
(function($, window, undefined){
var lastTime=0,
running,
animate=function (elem){
if(running){
window.requestAnimationFrame(animate, elem);
jQuery.fx.tick();
}},
vendors=['ms', 'moz', 'webkit', 'o'];
for(var x=0; x < vendors.length&&!window.requestAnimationFrame; ++x){
window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if(!window.requestAnimationFrame)
window.requestAnimationFrame=function(fn, element){
var currTime=new Date().getTime(),
delta=currTime - lastTime,
timeToCall=Math.max(0, 16 - delta);
var id=window.setTimeout(function(){
fn(currTime + timeToCall);
},
timeToCall
);
lastTime=currTime + timeToCall;
return id;
};
if(!window.cancelAnimationFrame){
window.cancelAnimationFrame=function(id){
clearTimeout(id);
};}
jQuery.fx.timer=function (timer){
if(timer()&&jQuery.timers.push(timer)&&!running){
running=true;
animate(timer.elem);
}};
jQuery.fx.stop=function(){
running=false;
};}(jQuery, this));
(function($){
var types=['DOMMouseScroll', 'mousewheel'];
if($.event.fixHooks){
for (var i=types.length; i;){
$.event.fixHooks[types[--i]]=$.event.mouseHooks;
}}
$.event.special.mousewheel={
setup: function(){
if(this.addEventListener){
for (var i=types.length; i;){
this.addEventListener(types[--i], handler, false);
}}else{
this.onmousewheel=handler;
}},
teardown: function(){
if(this.removeEventListener){
for (var i=types.length; i;){
this.removeEventListener(types[--i], handler, false);
}}else{
this.onmousewheel=null;
}}
};
$.fn.extend({
mousewheel: function(fn){
return fn ? this.bind("mousewheel", fn):this.trigger("mousewheel");
},
unmousewheel: function(fn){
return this.unbind("mousewheel", fn);
}});
function handler(event){
var orgEvent=event||window.event,
args=[].slice.call(arguments, 1),
delta=0,
returnValue=true,
deltaX=0,
deltaY=0;
event=$.event.fix(orgEvent);
event.type="mousewheel";
if(orgEvent.wheelDelta){
delta=orgEvent.wheelDelta / 120;
}
if(orgEvent.detail){
delta=-orgEvent.detail / 3;
}
deltaY=delta;
if(orgEvent.axis!==undefined&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){
deltaY=0;
deltaX=-1 * delta;
}
if(orgEvent.wheelDeltaY!==undefined){
deltaY=orgEvent.wheelDeltaY / 120;
}
if(orgEvent.wheelDeltaX!==undefined){
deltaX=-1 * orgEvent.wheelDeltaX / 120;
}
args.unshift(event, delta, deltaX, deltaY);
return ($.event.dispatch||$.event.handle).apply(this, args);
}})(jQuery);
(function($, window, undefined){
var extensions={
flash: ['swf'],
image: ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'tiff', 'tif', 'jfif', 'jpe'],
iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'jsp', 'php', 'pl', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt'],
video: ['avi', 'mov', 'mpg', 'mpeg', 'movie', 'mp4', 'webm', 'ogv', 'ogg', '3gp', 'm4v']
},
$win=$(window),
$doc=$(document),
browser,
transform,
gpuAcceleration,
fullScreenApi='',
userAgent=navigator.userAgent||navigator.vendor||window.opera,
supportTouch="ontouchstart" in window||navigator.msMaxTouchPoints,
isMobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4)),
clickEvent=supportTouch ? "itap.iLightBox":"click.iLightBox",
touchStartEvent=supportTouch ? "touchstart.iLightBox":"mousedown.iLightBox",
touchStopEvent=supportTouch ? "touchend.iLightBox":"mouseup.iLightBox",
touchMoveEvent=supportTouch ? "touchmove.iLightBox":"mousemove.iLightBox",
abs=Math.abs,
sqrt=Math.sqrt,
round=Math.round,
max=Math.max,
min=Math.min,
floor=Math.floor,
random=Math.random,
pluginspages={
quicktime: 'http://www.apple.com/quicktime/download',
flash: 'http://www.adobe.com/go/getflash'
},
iLightBox=function(el, options, items, instant){
var iL=this;
iL.options=options,
iL.selector=el.selector||el,
iL.context=el.context,
iL.instant=instant;
if(items.length < 1) iL.attachItems();
else iL.items=items;
iL.vars={
total: iL.items.length,
start: 0,
current: null,
next: null,
prev: null,
BODY: $('body'),
loadRequests: 0,
overlay: $('
'),
loader: $(''),
toolbar: $('
'),
innerToolbar: $('
'),
title: $('
'),
closeButton: $(' '),
fullScreenButton: $(' '),
innerPlayButton: $(' '),
innerNextButton: $(' '),
innerPrevButton: $(' '),
holder: $(''),
nextPhoto: $(''),
prevPhoto: $(''),
nextButton: $(' '),
prevButton: $(' '),
thumbnails: $(''),
thumbs: false,
nextLock: false,
prevLock: false,
hashLock: false,
isMobile: false,
mobileMaxWidth: 980,
isInFullScreen: false,
isSwipe: false,
mouseID: 0,
cycleID: 0,
isPaused: 0,
captionHeight: 39,
};
iL.vars.hideableElements=iL.vars.nextButton.add(iL.vars.prevButton);
iL.normalizeItems();
iL.availPlugins();
iL.options.startFrom=(iL.options.startFrom > 0&&iL.options.startFrom >=iL.vars.total) ? iL.vars.total - 1:iL.options.startFrom;
iL.options.startFrom=(iL.options.randomStart) ? floor(random() * iL.vars.total):iL.options.startFrom;
iL.vars.start=iL.options.startFrom;
if(instant) iL.instantCall();
else iL.patchItemsEvents();
if(iL.options.linkId){
iL.hashChangeHandler();
$win.iLightBoxHashChange(function(){
iL.hashChangeHandler();
});
}
if(supportTouch){
var RegExp=/(click|mouseenter|mouseleave|mouseover|mouseout)/ig,
replace="itap";
iL.options.caption.show=iL.options.caption.show.replace(RegExp, replace),
iL.options.caption.hide=iL.options.caption.hide.replace(RegExp, replace),
iL.options.social.show=iL.options.social.show.replace(RegExp, replace),
iL.options.social.hide=iL.options.social.hide.replace(RegExp, replace);
}
if(iL.options.controls.arrows||$(window).width() < UNCODE.mediaQuery){
$.extend(iL.options.styles, {
nextOffsetX: ($(window).width() > UNCODE.mediaQuery) ? 36:4,
prevOffsetX: ($(window).width() > UNCODE.mediaQuery) ? 36:4,
nextOpacity: 0,
prevOpacity: 0
});
}};
iLightBox.prototype={
showLoader: function(){
var iL=this;
iL.vars.loadRequests +=1;
if(iL.options.path.toLowerCase()=="horizontal") iL.vars.loader.addClass('ilightbox-show').stop().animate({
opacity: '1'
}, iL.options.show.speed, 'easeOutCirc');
else iL.vars.loader.addClass('ilightbox-show').stop().animate({
opacity: '1'
}, iL.options.show.speed, 'easeOutCirc');
},
hideLoader: function(){
var iL=this;
iL.vars.loadRequests -=1;
iL.vars.loadRequests=(iL.vars.loadRequests < 0) ? 0:iL.vars.loadRequests;
if(iL.options.path.toLowerCase()=="horizontal"){
if(iL.vars.loadRequests <=0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({
opacity: '0'
}, iL.options.show.speed, 'easeInCirc');
}else{
if(iL.vars.loadRequests <=0) iL.vars.loader.removeClass('ilightbox-show').stop().animate({
opacity: '0'
}, iL.options.show.speed, 'easeInCirc');
}},
createUI: function(){
var iL=this;
iL.ui={
currentElement: iL.vars.holder,
nextElement: iL.vars.nextPhoto,
prevElement: iL.vars.prevPhoto,
currentItem: iL.vars.current,
nextItem: iL.vars.next,
prevItem: iL.vars.prev,
hide: function(){
iL.closeAction();
},
refresh: function(){
(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
},
fullscreen: function(){
iL.fullScreenAction();
}};},
attachItems: function(){
var iL=this,
itemsObject=new Array(),
items=new Array();
$(iL.selector, iL.context).each(function(){
var t=$(this),
URL=t.attr(iL.options.attr)||null,
options=t.data("options")&&eval("({" + t.data("options") + "})")||{},
caption=t.data('caption'),
title=t.data('title'),
type=t.data('type')||getTypeByExtension(URL),
clone=t.data('lbox-clone')||false;
if(t.data('lbox-clone')!=undefined) return;
if(typeof t.attr('data-album')!='undefined'&&t.attr('data-album')!=''){
var ALBUM_URLS=JSON.parse(t.attr('data-album')),
URL_i,
URLS_LENGHT=ALBUM_URLS.length;
for (URL_i=0; URL_i < URLS_LENGHT; URL_i++){
if(typeof ALBUM_URLS[URL_i].url!=='undefined'&&ALBUM_URLS[URL_i].url!=''){
var item_opts='width:' + ALBUM_URLS[URL_i].width + ',height:' + ALBUM_URLS[URL_i].height + ',thumbnail: \'' + ALBUM_URLS[URL_i].thumbnail + '\'';
item_opts=item_opts&&eval("({" + item_opts + "})")||{},
items.push({
URL: ALBUM_URLS[URL_i].url,
caption: ALBUM_URLS[URL_i].caption,
title: ALBUM_URLS[URL_i].title,
type: getTypeByExtension(ALBUM_URLS[URL_i].url),
options: item_opts,
clone: clone
});
var newT=t;
newT.attr('href',ALBUM_URLS[URL_i].url);
if(!iL.instant) itemsObject.push(newT);
}}
}else{
items.push({
URL: URL,
caption: caption,
title: title,
type: type,
options: options,
clone: clone
});
}
if(iL.vars!=undefined) iL.vars.total=items.length;
if(!iL.instant) itemsObject.push(t);
});
iL.items=items,
iL.itemsObject=itemsObject;
},
normalizeItems: function(){
var iL=this,
newItems=new Array();
$.each(iL.items, function(key, val){
if(typeof val=="string") val={
url: val
};
var URL=val.url||val.URL||null,
options=val.options||{},
caption=val.caption||null,
title=val.title||null,
type=(val.type) ? val.type.toLowerCase():getTypeByExtension(URL),
ext=(typeof URL!='object') ? getExtension(URL):'';
options.thumbnail=options.thumbnail||((type=="image") ? URL:null),
options.videoType=options.videoType||null,
options.skin=options.skin||iL.options.skin,
options.width=options.width||null,
options.height=options.height||null,
options.mousewheel=(typeof options.mousewheel!='undefined') ? options.mousewheel:true,
options.swipe=(typeof options.swipe!='undefined') ? options.swipe:true,
options.social=(typeof options.social!='undefined') ? options.social:iL.options.social.buttons&&$.extend({}, {}, iL.options.social.buttons);
if(type=="video"){
options.html5video=(typeof options.html5video!='undefined') ? options.html5video:{};
options.html5video.webm=options.html5video.webm||options.html5video.WEBM||null;
options.html5video.controls=(typeof options.html5video.controls!='undefined') ? options.html5video.controls:"controls";
options.html5video.preload=options.html5video.preload||"metadata";
options.html5video.autoplay=(typeof options.html5video.autoplay!='undefined') ? options.html5video.autoplay:false;
options.html5video.loop=(typeof options.html5video.loop!='undefined') ? options.html5video.loop:false;
}
if(!options.width||!options.height){
if(type=="video") options.width=1280, options.height=720;
else if(type=="iframe") options.width='100%', options.height='90%';
else if(type=="flash") options.width=1280, options.height=720;
}
delete val.url;
val.index=key;
val.URL=URL;
val.caption=caption;
val.title=title;
val.type=type;
val.options=options;
val.ext=ext;
newItems.push(val);
});
iL.items=newItems;
},
instantCall: function(){
var iL=this,
key=iL.vars.start;
iL.vars.current=key;
iL.vars.next=(iL.items[key + 1]) ? key + 1:null;
iL.vars.prev=(iL.items[key - 1]) ? key - 1:null;
iL.addContents();
iL.patchEvents();
},
addContents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
viewport=getViewport(),
path=opts.path.toLowerCase(),
recognizingItems=vars.total > 0&&iL.items.filter(function(e, i, arr){
return ['image', 'flash', 'video'].indexOf(e.type)===-1&&typeof e.recognized==='undefined'&&(opts.smartRecognition||e.options.smartRecognition);
}),
needRecognition=recognizingItems.length > 0;
if(opts.mobileOptimizer&&!opts.innerToolbar)
vars.isMobile=viewport.width <=vars.mobileMaxWidth;
vars.overlay.addClass(opts.skin).hide().css('opacity', opts.overlay.opacity);
if(opts.linkId)
vars.overlay[0].setAttribute('linkid', opts.linkId);
if(opts.controls.toolbar){
vars.toolbar.addClass(opts.skin).append(vars.closeButton);
if(opts.controls.fullscreen)
vars.toolbar.append(vars.fullScreenButton);
if(opts.controls.slideshow)
vars.toolbar.append(vars.innerPlayButton);
if(vars.total > 1)
vars.toolbar.append(vars.innerPrevButton).append(vars.innerNextButton);
}
vars.BODY.addClass('ilightbox-noscroll').append(vars.overlay).append(vars.loader).append(vars.holder).append(vars.nextPhoto).append(vars.prevPhoto);
if(!opts.innerToolbar)
vars.BODY.append(vars.toolbar);
if(opts.controls.arrows)
vars.BODY.append(vars.nextButton).append(vars.prevButton);
if(opts.controls.thumbnail&&vars.total > 1){
vars.BODY.append(vars.thumbnails);
vars.thumbnails.addClass(opts.skin).addClass('ilightbox-' + path);
$('div.ilightbox-thumbnails-grid', vars.thumbnails).empty();
vars.thumbs=true;
}
var loaderCss=(opts.path.toLowerCase()=="horizontal") ? {
left: parseInt((viewport.width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((viewport.height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.addClass(opts.skin).css(loaderCss);
vars.nextButton.add(vars.prevButton).addClass(opts.skin);
if(path=="horizontal")
vars.loader.add(vars.nextButton).add(vars.prevButton).addClass('horizontal');
vars.BODY[vars.isMobile ? 'addClass':'removeClass']('isMobile');
if(!opts.infinite){
vars.prevButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0)
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
if(vars.current >=vars.total - 1)
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}
if(opts.show.effect){
vars.overlay.stop().fadeIn(opts.show.speed);
vars.toolbar.stop().fadeIn(opts.show.speed);
}else{
vars.overlay.show();
vars.toolbar.show();
}
var length=recognizingItems.length;
if(needRecognition){
iL.showLoader();
$.each(recognizingItems, function(key, val){
var resultFnc=function(result){
var key=-1,
filter=iL.items.filter(function(e, i, arr){
if(e.URL==result.url)
key=i;
return e.URL==result.url;
}),
self=iL.items[key];
if(result)
$.extend(true, self, {
URL: result.source,
type: result.type,
recognized: true,
options: {
html5video: result.html5video,
width: (result.type=="image") ? 0:(result.width||self.width),
height: (result.type=="image") ? 0:(result.height||self.height),
thumbnail: self.options.thumbnail||result.thumbnail
}});
length--;
if(length==0){
iL.hideLoader();
vars.dontGenerateThumbs=false;
iL.generateThumbnails();
if(opts.show.effect)
setTimeout(function(){
iL.generateBoxes();
}, opts.show.speed);
else
iL.generateBoxes();
}};
iL.ogpRecognition(this, resultFnc);
});
}else{
if(opts.show.effect)
setTimeout(function(){
iL.generateBoxes();
}, opts.show.speed);
else
iL.generateBoxes();
}
iL.createUI();
window.iLightBox={
close: function(){
iL.closeAction();
},
fullscreen: function(){
iL.fullScreenAction();
},
moveNext: function(){
iL.moveTo('next');
},
movePrev: function(){
iL.moveTo('prev');
},
goTo: function(index){
iL.goTo(index);
},
refresh: function(){
iL.refresh();
},
reposition: function(){
(arguments.length > 0) ? iL.repositionPhoto(true): iL.repositionPhoto();
},
setOption: function(options){
iL.setOption(options);
},
destroy: function(){
iL.closeAction();
iL.dispatchItemsEvents();
}};
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + vars.current;
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(!opts.slideshow.startPaused){
iL.resume();
vars.innerPlayButton.removeClass('ilightbox-play').addClass('ilightbox-pause');
}
if(typeof iL.options.callback.onOpen=='function') iL.options.callback.onOpen.call(iL);
},
loadContent: function(obj, opt, speed){
var iL=this,
holder, item;
iL.createUI();
obj.speed=speed||iL.options.effects.loadedFadeSpeed;
if(opt=='current'){
if(!obj.options.mousewheel) iL.vars.lockWheel=true;
else iL.vars.lockWheel=false;
if(!obj.options.swipe) iL.vars.lockSwipe=true;
else iL.vars.lockSwipe=false;
}
switch (opt){
case 'current':
holder=iL.vars.holder, item=iL.vars.current;
break;
case 'next':
holder=iL.vars.nextPhoto, item=iL.vars.next;
break;
case 'prev':
holder=iL.vars.prevPhoto, item=iL.vars.prev;
break;
}
holder.removeAttr('style class').addClass('ilightbox-holder' + (supportTouch ? ' supportTouch':'')).addClass(obj.options.skin);
$('div.ilightbox-inner-toolbar', holder).remove();
if(obj.title||iL.options.innerToolbar){
var innerToolbar=iL.vars.innerToolbar.clone();
if(obj.title&&iL.options.show.title){
var title=iL.vars.title.clone();
title.empty().html(obj.title);
innerToolbar.append(title);
}
if(iL.options.innerToolbar){
innerToolbar.append((iL.vars.total > 1) ? iL.vars.toolbar.clone():iL.vars.toolbar);
}
holder.prepend(innerToolbar);
}
iL.loadSwitcher(obj, holder, item, opt);
},
loadSwitcher: function(obj, holder, item, opt){
var iL=this,
opts=iL.options,
api={
element: holder,
position: item
};
switch (obj.type){
case 'image':
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.loadImage(obj.URL, function(img){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
var width=(img) ? img.width:400,
height=(img) ? img.height:200;
holder.data({
naturalWidth: width,
naturalHeight: height
});
$('div.ilightbox-container', holder).empty().append((img) ? ' ':'' + opts.errors.loadImage + ' ');
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
iL.configureHolder(obj, opt, holder);
});
break;
case 'video':
holder.data({
naturalWidth: obj.options.width,
naturalHeight: obj.options.height
});
if(opt==='current'){
iL.addContent(holder, obj);
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
}else{
$('div.ilightbox-container', holder).empty();
}
iL.configureHolder(obj, opt, holder);
break;
case 'iframe':
holder.data({
naturalWidth: obj.options.width,
naturalHeight: obj.options.height
});
iL.configureHolder(obj, opt, holder);
if(opt==='current'){
var el=iL.addContent(holder, obj);
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
el.bind('load', function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
el.unbind('load');
});
}else{
$('div.ilightbox-container', holder).empty();
}
break;
case 'inline':
var el=$(obj.URL),
content=iL.addContent(holder, obj),
images=findImageInElement(holder);
holder.data({
naturalWidth: (iL.items[item].options.width||el.outerWidth()),
naturalHeight: (iL.items[item].options.height||el.outerHeight())
});
content.children().eq(0).show();
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
iL.configureHolder(obj, opt, holder);
});
break;
case 'flash':
var el=iL.addContent(holder, obj);
holder.data({
naturalWidth: (iL.items[item].options.width||el.outerWidth()),
naturalHeight: (iL.items[item].options.height||el.outerHeight())
});
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
iL.configureHolder(obj, opt, holder);
break;
case 'ajax':
var ajax=obj.options.ajax||{};
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.showLoader();
$.ajax({
url: obj.URL||opts.ajaxSetup.url,
data: ajax.data||null,
dataType: ajax.dataType||"html",
type: ajax.type||opts.ajaxSetup.type,
cache: ajax.cache||opts.ajaxSetup.cache,
crossDomain: ajax.crossDomain||opts.ajaxSetup.crossDomain,
global: ajax.global||opts.ajaxSetup.global,
ifModified: ajax.ifModified||opts.ajaxSetup.ifModified,
username: ajax.username||opts.ajaxSetup.username,
password: ajax.password||opts.ajaxSetup.password,
beforeSend: ajax.beforeSend||opts.ajaxSetup.beforeSend,
complete: ajax.complete||opts.ajaxSetup.complete,
success: function(data, textStatus, jqXHR){
iL.hideLoader();
var el=$(data),
container=$('div.ilightbox-container', holder),
elWidth=iL.items[item].options.width||parseInt(el[0].getAttribute('width')),
elHeight=iL.items[item].options.height||parseInt(el[0].getAttribute('height')),
css=(el[0].getAttribute('width')&&el[0].getAttribute('height')) ? {
'overflow': 'hidden'
}:{};
container.empty().append($('
').css(css).html(el));
holder.show().data({
naturalWidth: (elWidth||container.outerWidth()),
naturalHeight: (elHeight||container.outerHeight())
}).hide();
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
var images=findImageInElement(holder);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
iL.configureHolder(obj, opt, holder);
});
opts.ajaxSetup.success(data, textStatus, jqXHR);
if(typeof ajax.success=='function') ajax.success(data, textStatus, jqXHR);
},
error: function(jqXHR, textStatus, errorThrown){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
iL.hideLoader();
$('div.ilightbox-container', holder).empty().append('' + opts.errors.loadContents + ' ');
iL.configureHolder(obj, opt, holder);
opts.ajaxSetup.error(jqXHR, textStatus, errorThrown);
if(typeof ajax.error=='function') ajax.error(jqXHR, textStatus, errorThrown);
}});
break;
case 'html':
var object=obj.URL,
el
container=$('div.ilightbox-container', holder);
if(object[0].nodeName) el=object.clone();
else {
var dom=$(object);
if(dom.selector) el=$('' + dom + '
');
else el=dom;
}
var elWidth=iL.items[item].options.width||parseInt(el.attr('width')),
elHeight=iL.items[item].options.height||parseInt(el.attr('height'));
iL.addContent(holder, obj);
el.appendTo(document.documentElement).hide();
if(typeof opts.callback.onRender=='function') opts.callback.onRender.call(iL, iL.ui, item);
if(typeof obj.options.onRender=='function') obj.options.onRender.call(iL, api);
var images=findImageInElement(holder);
if(typeof opts.callback.onBeforeLoad=='function') opts.callback.onBeforeLoad.call(iL, iL.ui, item);
if(typeof obj.options.onBeforeLoad=='function') obj.options.onBeforeLoad.call(iL, api);
iL.loadImage(images, function(){
if(typeof opts.callback.onAfterLoad=='function') opts.callback.onAfterLoad.call(iL, iL.ui, item);
if(typeof obj.options.onAfterLoad=='function') obj.options.onAfterLoad.call(iL, api);
holder.show().data({
naturalWidth: (elWidth||container.outerWidth()),
naturalHeight: (elHeight||container.outerHeight())
}).hide();
el.remove();
iL.configureHolder(obj, opt, holder);
});
break;
}},
configureHolder: function(obj, opt, holder){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opt!="current")(opt=="next") ? holder.addClass('ilightbox-next'):holder.addClass('ilightbox-prev');
if(opt=="current")
var item=vars.current;
else if(opt=="next")
var opacity=opts.styles.nextOpacity,
item=vars.next;
else
var opacity=opts.styles.prevOpacity,
item=vars.prev;
var api={
element: holder,
position: item
};
iL.items[item].options.width=iL.items[item].options.width||0,
iL.items[item].options.height=iL.items[item].options.height||0;
if(opt=="current"){
if(opts.show.effect) holder.css(transform, gpuAcceleration).fadeIn(obj.speed, function(){
holder.css(transform, '');
if(obj.caption){
iL.setCaption(obj, holder);
var caption=$('div.ilightbox-caption', holder),
percent=parseInt((caption.outerHeight() / holder.outerHeight()) * 100);
if(opts.caption.start & percent <=50) caption.fadeIn(opts.effects.fadeSpeed);
}
var social=obj.options.social;
if(social){
iL.setSocial(social, obj.URL, holder);
if(opts.social.start) $('div.ilightbox-social', holder).fadeIn(opts.effects.fadeSpeed);
}
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
});
else {
holder.show();
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
}}else{
if(opts.show.effect) holder.fadeTo(obj.speed, opacity, function(){
if(opt=="next") vars.nextLock=false;
else vars.prevLock=false;
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
});
else {
holder.css({
opacity: opacity
}).show();
if(opt=="next") vars.nextLock=false;
else vars.prevLock=false;
iL.generateThumbnails();
if(typeof opts.callback.onShow=='function') opts.callback.onShow.call(iL, iL.ui, item);
if(typeof obj.options.onShow=='function') obj.options.onShow.call(iL, api);
}}
setTimeout(function(){
iL.repositionPhoto();
}, 0);
},
generateBoxes: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.infinite&&vars.total >=3){
if(vars.current==vars.total - 1) vars.next=0;
if(vars.current==0) vars.prev=vars.total - 1;
} else opts.infinite=false;
if(typeof iL.items[vars.current]=='undefined')
vars.current=0;
iL.loadContent(iL.items[vars.current], 'current', opts.show.speed);
if(iL.items[vars.next]) iL.loadContent(iL.items[vars.next], 'next', opts.show.speed);
if(iL.items[vars.prev]) iL.loadContent(iL.items[vars.prev], 'prev', opts.show.speed);
},
generateThumbnails: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
timeOut=null;
if(vars.thumbs&&!iL.vars.dontGenerateThumbs){
var thumbnails=vars.thumbnails,
container=$('div.ilightbox-thumbnails-container', thumbnails),
grid=$('div.ilightbox-thumbnails-grid', container),
i=0;
grid.removeAttr('style').empty();
$.each(iL.items, function(key, val){
var isActive=(vars.current==key) ? 'ilightbox-active':'',
opacity=(vars.current==key) ? opts.thumbnails.activeOpacity:opts.thumbnails.normalOpacity,
thumb=val.options.thumbnail,
thumbnail=$('
'),
icon=$('
');
thumbnail.css({
opacity: 0
}).addClass(isActive);
if((val.type=="video"||val.type=="flash")&&typeof val.options.icon=='undefined'){
icon.addClass('ilightbox-thumbnail-video');
thumbnail.append(icon);
}else if(val.options.icon){
icon.addClass('ilightbox-thumbnail-' + val.options.icon);
thumbnail.append(icon);
}
if(thumb) iL.loadImage(thumb, function(img){
i++;
if(img) thumbnail.data({
naturalWidth: img.width,
naturalHeight: img.height
}).append(' ');
else thumbnail.data({
naturalWidth: opts.thumbnails.maxWidth,
naturalHeight: opts.thumbnails.maxHeight
});
clearTimeout(timeOut);
timeOut=setTimeout(function(){
iL.positionThumbnails(thumbnails, container, grid);
}, 20);
setTimeout(function(){
thumbnail.fadeTo(opts.effects.loadedFadeSpeed, opacity);
}, i * 20);
});
grid.append(thumbnail);
});
iL.vars.dontGenerateThumbs=true;
}},
positionThumbnails: function(thumbnails, container, grid){
var iL=this,
vars=iL.vars,
opts=iL.options,
viewport=getViewport(),
path=opts.path.toLowerCase();
if(!thumbnails) thumbnails=vars.thumbnails;
if(!container) container=$('div.ilightbox-thumbnails-container', thumbnails);
if(!grid) grid=$('div.ilightbox-thumbnails-grid', container);
var thumbs=$('.ilightbox-thumbnail', grid),
widthAvail=(path=='horizontal') ? viewport.width - opts.styles.pageOffsetX:thumbs.eq(0).outerWidth() - opts.styles.pageOffsetX,
heightAvail=(path=='horizontal') ? thumbs.eq(0).outerHeight() - opts.styles.pageOffsetY:viewport.height - opts.styles.pageOffsetY,
gridWidth=(path=='horizontal') ? 0:widthAvail,
gridHeight=(path=='horizontal') ? heightAvail:0,
active=$('.ilightbox-active', grid),
gridCss={},
css={};
if(arguments.length < 3){
thumbs.css({
opacity: opts.thumbnails.normalOpacity
});
active.css({
opacity: opts.thumbnails.activeOpacity
});
}
thumbs.each(function(i){
var t=$(this),
data=t.data(),
width=(path=='horizontal') ? 0:opts.thumbnails.maxWidth;
height=(path=='horizontal') ? opts.thumbnails.maxHeight:0;
dims=iL.getNewDimenstions(width, height, data.naturalWidth, data.naturalHeight, true);
t.css({
width: dims.width,
height: dims.height
});
if(path=='horizontal') t.css({
'float': 'left'
});
(path=='horizontal') ? (
gridWidth +=t.outerWidth()
):(
gridHeight +=t.outerHeight()
);
});
gridCss={
width: gridWidth,
height: gridHeight
};
grid.css(gridCss);
gridCss={};
var gridOffset=grid.offset(),
activeOffset=(active.length) ? active.offset():{
top: parseInt(heightAvail / 2),
left: parseInt(widthAvail / 2)
};
gridOffset.top=(gridOffset.top - $doc.scrollTop()),
gridOffset.left=(gridOffset.left - $doc.scrollLeft()),
activeOffset.top=(activeOffset.top - gridOffset.top - $doc.scrollTop()),
activeOffset.left=(activeOffset.left - gridOffset.left - $doc.scrollLeft());
(path=='horizontal') ? (
gridCss.top=0,
gridCss.left=parseInt((widthAvail / 2) - activeOffset.left - (active.outerWidth() / 2))
):(
gridCss.top=parseInt(((heightAvail / 2) - activeOffset.top - (active.outerHeight() / 2))),
gridCss.left=0
);
if(arguments.length < 3) grid.stop().animate(gridCss, opts.effects.repositionSpeed, 'easeOutCirc');
else grid.css(gridCss);
},
loadImage: function(image, callback){
if(!$.isArray(image)) image=[image];
var iL=this,
length=image.length;
if(length > 0){
iL.showLoader();
$.each(image, function(index, value){
var img=new Image();
img.onload=function(){
length -=1;
if(length==0){
iL.hideLoader();
callback(img);
}};
img.onerror=img.onabort=function(){
length -=1;
if(length==0){
iL.hideLoader();
callback(false);
}};
img.src=image[index];
});
} else callback(false);
},
patchItemsEvents: function(){
var iL=this,
vars=iL.vars,
clickEvent=supportTouch ? "itap.iL":"click.iL",
vEvent=supportTouch ? "click.iL":"itap.iL";
if(iL.context&&iL.selector){
var $items=$(iL.selector, iL.context);
$(iL.context).on(clickEvent, iL.selector, function(){
var $this=$(this),
key=typeof $(this).data('lb-index')!==''&&$(this).closest('.owl-item').length ? $(this).data('lb-index'):$items.index($this);
if(UNCODE.isMobile){
var isCarousel=$this.closest('.owl-carousel');
if(isCarousel.length){
if(isCarousel.hasClass('owl-translating')) return false;
}}
vars.current=key;
vars.next=iL.items[key + 1] ? key + 1:null;
vars.prev=iL.items[key - 1] ? key - 1:null;
if(vars.BODY.hasClass('fp-slide-scrolling'))
return false;
iL.addContents();
iL.patchEvents();
return false;
}).on(vEvent, iL.selector, function(){
return false;
});
} else
$.each(iL.itemsObject, function(key, val){
val.on(clickEvent, function(){
vars.current=key;
vars.next=iL.items[key + 1] ? key + 1:null;
vars.prev=iL.items[key - 1] ? key - 1:null;
iL.addContents();
iL.patchEvents();
return false;
}).on(vEvent, function(){
return false;
});
});
},
dispatchItemsEvents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(iL.context&&iL.selector)
$(iL.context).off('.iL', iL.selector);
else
$.each(iL.itemsObject, function(key, val){
val.off('.iL');
});
},
refresh: function(){
var iL=this;
iL.dispatchItemsEvents();
iL.attachItems();
iL.normalizeItems();
iL.patchItemsEvents();
},
patchEvents: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
holders=$('.ilightbox-holder'),
fullscreenEvent=fullScreenApi.fullScreenEventName + '.iLightBox',
durationThreshold=1000,
horizontalDistanceThreshold =
verticalDistanceThreshold=100,
buttonsArray=[vars.nextButton[0], vars.prevButton[0], vars.nextButton[0].firstChild, vars.prevButton[0].firstChild];
$win.bind('resize.iLightBox', function(){
var viewport=getViewport();
if(opts.mobileOptimizer&&!opts.innerToolbar) vars.isMobile=viewport.width <=vars.mobileMaxWidth;
vars.BODY[vars.isMobile ? 'addClass':'removeClass']('isMobile');
iL.repositionPhoto(null);
if(supportTouch){
clearTimeout(vars.setTime);
vars.setTime=setTimeout(function(){
var scrollTop=getScrollXY().y;
window.scrollTo(0, scrollTop - 30);
window.scrollTo(0, scrollTop + 30);
window.scrollTo(0, scrollTop);
}, 2000);
}
if(vars.thumbs) iL.positionThumbnails();
}).bind('keydown.iLightBox', function(event){
if(opts.controls.keyboard){
switch (event.keyCode){
case 13:
if(event.shiftKey&&opts.keyboard.shift_enter) iL.fullScreenAction();
break;
case 27:
if(opts.keyboard.esc) iL.closeAction();
break;
case 37:
if(opts.keyboard.left&&!vars.lockKey) iL.moveTo('prev');
break;
case 38:
if(opts.keyboard.up&&!vars.lockKey) iL.moveTo('prev');
break;
case 39:
if(opts.keyboard.right&&!vars.lockKey) iL.moveTo('next');
break;
case 40:
if(opts.keyboard.down&&!vars.lockKey) iL.moveTo('next');
break;
}}
});
if(fullScreenApi.supportsFullScreen) $win.bind(fullscreenEvent, function(){
iL.doFullscreen();
});
var holderEventsArr=[opts.caption.show + '.iLightBox', opts.caption.hide + '.iLightBox', opts.social.show + '.iLightBox', opts.social.hide + '.iLightBox'].filter(function(e, i, arr){
return arr.lastIndexOf(e)===i;
}),
holderEvents="";
$.each(holderEventsArr, function(key, val){
if(key!=0) holderEvents +=' ';
holderEvents +=val;
});
$doc.on(clickEvent, '.ilightbox-overlay', function(){
if(opts.overlay.blur) iL.closeAction();
}).on(clickEvent, '.ilightbox-next, .ilightbox-next-button', function(){
iL.moveTo('next');
}).on(clickEvent, '.ilightbox-prev, .ilightbox-prev-button', function(){
iL.moveTo('prev');
}).on(clickEvent, '.ilightbox-thumbnail', function(){
var t=$(this),
thumbs=$('.ilightbox-thumbnail', vars.thumbnails),
index=thumbs.index(t);
if(index!=vars.current) iL.goTo(index);
}).on(holderEvents, '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e){
var caption=$('div.ilightbox-caption', vars.holder),
social=$('div.ilightbox-social', vars.holder),
fadeSpeed=opts.effects.fadeSpeed;
if(vars.nextLock||vars.prevLock){
if(e.type==opts.caption.show&&!caption.is(':visible')) caption.fadeIn(fadeSpeed);
else if(e.type==opts.caption.hide&&caption.is(':visible')) caption.fadeOut(fadeSpeed);
if(e.type==opts.social.show&&!social.is(':visible')) social.fadeIn(fadeSpeed);
else if(e.type==opts.social.hide&&social.is(':visible')) social.fadeOut(fadeSpeed);
}else{
if(e.type==opts.caption.show&&!caption.is(':visible')) caption.stop().fadeIn(fadeSpeed);
else if(e.type==opts.caption.hide&&caption.is(':visible')) caption.stop().fadeOut(fadeSpeed);
if(e.type==opts.social.show&&!social.is(':visible')) social.stop().fadeIn(fadeSpeed);
else if(e.type==opts.social.hide&&social.is(':visible')) social.stop().fadeOut(fadeSpeed);
}}).on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-wrapper', function(e){
if(e.type=='mouseenter') vars.lockWheel=true;
else vars.lockWheel=false;
}).on(clickEvent, '.ilightbox-toolbar a.ilightbox-close, .ilightbox-toolbar a.ilightbox-fullscreen, .ilightbox-toolbar a.ilightbox-play, .ilightbox-toolbar a.ilightbox-pause', function(){
var t=$(this);
if(t.hasClass('ilightbox-fullscreen')) iL.fullScreenAction();
else if(t.hasClass('ilightbox-play')){
iL.resume();
t.addClass('ilightbox-pause').removeClass('ilightbox-play');
}else if(t.hasClass('ilightbox-pause')){
iL.pause();
t.addClass('ilightbox-play').removeClass('ilightbox-pause');
} else iL.closeAction();
}).on(touchMoveEvent, '.ilightbox-overlay, .ilightbox-thumbnails-container', function(e){
e.preventDefault();
});
function mouseMoveHandler(e){
if(!vars.isMobile){
if(!vars.mouseID){
vars.hideableElements.show();
}
vars.mouseID=clearTimeout(vars.mouseID);
if(buttonsArray.indexOf(e.target)===-1)
vars.mouseID=setTimeout(function(){
vars.hideableElements.hide();
vars.mouseID=clearTimeout(vars.mouseID);
}, 3000);
}}
if(opts.controls.arrows&&!supportTouch) $doc.on('mousemove.iLightBox', mouseMoveHandler);
if(opts.controls.slideshow&&opts.slideshow.pauseOnHover) $doc.on('mouseenter.iLightBox mouseleave.iLightBox', '.ilightbox-holder:not(.ilightbox-next, .ilightbox-prev)', function(e){
if(e.type=='mouseenter'&&vars.cycleID) iL.pause();
else if(e.type=='mouseleave'&&vars.isPaused) iL.resume();
});
var switchers=$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails');
if(opts.controls.mousewheel) switchers.on('mousewheel.iLightBox', function(event, delta){
if(!vars.lockWheel){
event.preventDefault();
if(delta < 0) iL.moveTo('next');
else if(delta > 0) iL.moveTo('prev');
}});
if(opts.controls.swipe) holders.on(touchStartEvent, function(event){
if(vars.nextLock||vars.prevLock||vars.total==1||vars.lockSwipe) return;
vars.BODY.addClass('ilightbox-closedhand');
var data=event.originalEvent.touches ? event.originalEvent.touches[0]:event,
scrollTop=$doc.scrollTop(),
scrollLeft=$doc.scrollLeft(),
offsets=[
holders.eq(0).offset(),
holders.eq(1).offset(),
holders.eq(2).offset()
],
offSet=[{
top: offsets[0].top - scrollTop,
left: offsets[0].left - scrollLeft
}, {
top: offsets[1].top - scrollTop,
left: offsets[1].left - scrollLeft
}, {
top: offsets[2].top - scrollTop,
left: offsets[2].left - scrollLeft
}],
start={
time: (new Date()).getTime(),
coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
},
stop;
function moveEachHandler(i){
var t=$(this),
offset=offSet[i],
scroll=[(start.coords[0] - stop.coords[0]), (start.coords[1] - stop.coords[1])];
t[0].style[path=="horizontal" ? 'left':'top']=(path=="horizontal" ? offset.left - scroll[0]:offset.top - scroll[1]) + 'px';
}
function moveHandler(event){
if(!start) return;
var data=event.originalEvent.touches ? event.originalEvent.touches[0]:event;
stop={
time: (new Date()).getTime(),
coords: [data.pageX - scrollLeft, data.pageY - scrollTop]
};
holders.each(moveEachHandler);
event.preventDefault();
}
function repositionHolders(){
holders.each(function(){
var t=$(this),
offset=t.data('offset')||{
top: t.offset().top - scrollTop,
left: t.offset().left - scrollLeft
},
top=offset.top,
left=offset.left;
t.css(transform, gpuAcceleration).stop().animate({
top: top,
left: left
}, 500, 'easeOutCirc', function(){
t.css(transform, '');
});
});
}
holders.bind(touchMoveEvent, moveHandler);
$doc.one(touchStopEvent, function(event){
holders.unbind(touchMoveEvent, moveHandler);
vars.BODY.removeClass('ilightbox-closedhand');
if(start&&stop){
if(path=="horizontal"&&stop.time - start.time < durationThreshold&&abs(start.coords[0] - stop.coords[0]) > horizontalDistanceThreshold&&abs(start.coords[1] - stop.coords[1]) < verticalDistanceThreshold){
if(start.coords[0] > stop.coords[0]){
if(vars.current==vars.total - 1&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('next');
}}else{
if(vars.current==0&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('prev');
}}
}else if(path=="vertical"&&stop.time - start.time < durationThreshold&&abs(start.coords[1] - stop.coords[1]) > horizontalDistanceThreshold&&abs(start.coords[0] - stop.coords[0]) < verticalDistanceThreshold){
if(start.coords[1] > stop.coords[1]){
if(vars.current==vars.total - 1&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('next');
}}else{
if(vars.current==0&&!opts.infinite) repositionHolders();
else {
vars.isSwipe=true;
iL.moveTo('prev');
}}
} else repositionHolders();
}
start=stop=undefined;
});
});
},
goTo: function(index){
var iL=this,
vars=iL.vars,
opts=iL.options,
diff=(index - vars.current);
if(opts.infinite){
if(index==vars.total - 1&&vars.current==0) diff=-1;
if(vars.current==vars.total - 1&&index==0) diff=1;
}
if(diff==1) iL.moveTo('next');
else if(diff==-1) iL.moveTo('prev');
else {
if(vars.nextLock||vars.prevLock) return false;
if(typeof opts.callback.onBeforeChange=='function') opts.callback.onBeforeChange.call(iL, iL.ui);
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + index;
}
if(iL.items[index]){
if(!iL.items[index].options.mousewheel) vars.lockWheel=true;
else iL.vars.lockWheel=false;
if(!iL.items[index].options.swipe) vars.lockSwipe=true;
else vars.lockSwipe=false;
}
$.each([vars.holder, vars.nextPhoto, vars.prevPhoto], function(key, val){
val.css(transform, gpuAcceleration).fadeOut(opts.effects.loadedFadeSpeed);
});
vars.current=index;
vars.next=index + 1;
vars.prev=index - 1;
iL.createUI();
setTimeout(function(){
iL.generateBoxes();
}, opts.effects.loadedFadeSpeed + 50);
$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(index).addClass('ilightbox-active');
iL.positionThumbnails();
if(opts.linkId) setTimeout(function(){
vars.hashLock=false;
}, 55);
if(!opts.infinite){
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0){
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
}
if(vars.current >=vars.total - 1){
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}}
iL.resetCycle();
if(typeof opts.callback.onAfterChange=='function') opts.callback.onAfterChange.call(iL, iL.ui);
}},
moveTo: function(side){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
switchSpeed=opts.effects.switchSpeed;
if(vars.nextLock||vars.prevLock) return false;
else {
var item=(side=="next") ? vars.next:vars.prev;
if(opts.linkId){
vars.hashLock=true;
window.location.hash=opts.linkId + '/' + item;
}
if(side=="next"){
if(!iL.items[item]) return false;
var firstHolder=vars.nextPhoto,
secondHolder=vars.holder,
lastHolder=vars.prevPhoto,
firstClass='ilightbox-prev',
secondClass='ilightbox-next';
}else if(side=="prev"){
if(!iL.items[item]) return false;
var firstHolder=vars.prevPhoto,
secondHolder=vars.holder,
lastHolder=vars.nextPhoto,
firstClass='ilightbox-next',
secondClass='ilightbox-prev';
}
if(typeof opts.callback.onBeforeChange=='function')
opts.callback.onBeforeChange.call(iL, iL.ui);
(side=="next") ? vars.nextLock=true: vars.prevLock=true;
var captionFirst=$('div.ilightbox-caption', secondHolder),
socialFirst=$('div.ilightbox-social', secondHolder);
if(captionFirst.length)
captionFirst.stop().fadeOut(switchSpeed, function(){
$(this).remove();
});
if(socialFirst.length)
socialFirst.stop().fadeOut(switchSpeed, function(){
$(this).remove();
});
if(iL.items[item].caption){
iL.setCaption(iL.items[item], firstHolder);
var caption=$('div.ilightbox-caption', firstHolder),
percent=parseInt((caption.outerHeight() / firstHolder.outerHeight()) * 100);
if(opts.caption.start&&percent <=50) caption.fadeIn(switchSpeed);
}
var social=iL.items[item].options.social;
if(social){
iL.setSocial(social, iL.items[item].URL, firstHolder);
if(opts.social.start) $('div.ilightbox-social', firstHolder).fadeIn(opts.effects.fadeSpeed);
}
$.each([firstHolder, secondHolder, lastHolder], function(key, val){
val.removeClass('ilightbox-next ilightbox-prev');
});
var firstOffset=firstHolder.data('offset'),
winW=(viewport.width - (opts.styles.pageOffsetX)),
winH=(viewport.height - (opts.styles.pageOffsetY)),
width=firstOffset.newDims.width,
height=firstOffset.newDims.height,
thumbsOffset=firstOffset.thumbsOffset,
diff=firstOffset.diff,
top=parseInt((winH / 2) - (height / 2) - diff.H - (thumbsOffset.H / 2)),
left=parseInt((winW / 2) - (width / 2) - diff.W - (thumbsOffset.W / 2));
var secondOffset=secondHolder.data('offset'),
object=secondOffset.object;
firstHolder.show().css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: 1
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
firstHolder.css(transform, '');
});
$('div.ilightbox-container', firstHolder).animate({
width: width,
height: height
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc');
diff=secondOffset.diff;
width=secondOffset.newDims.width,
height=secondOffset.newDims.height;
width=parseInt(width * opts.styles[side=='next' ? 'prevScale':'nextScale']),
height=parseInt(height * opts.styles[side=='next' ? 'prevScale':'nextScale']),
top=(path=='horizontal') ? parseInt((winH / 2) - object.offsetY - (height / 2) - diff.H - (thumbsOffset.H / 2)):parseInt(winH - object.offsetX - diff.H - (thumbsOffset.H / 2));
if(side=='prev')
left=(path=='horizontal') ? parseInt(winW - object.offsetX - diff.W - (thumbsOffset.W / 2)):parseInt((winW / 2) - (width / 2) - diff.W - object.offsetY - (thumbsOffset.W / 2));
else {
top=(path=='horizontal') ? top:parseInt(object.offsetX - diff.H - height - (thumbsOffset.H / 2)),
left=(path=='horizontal') ? parseInt(object.offsetX - diff.W - width - (thumbsOffset.W / 2)):parseInt((winW / 2) - object.offsetY - (width / 2) - diff.W - (thumbsOffset.W / 2));
}
$('div.ilightbox-container', secondHolder).animate({
width: width,
height: height
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc');
secondHolder.addClass(firstClass).css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: opts.styles.prevOpacity,
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
secondHolder.css(transform, '');
$('.ilightbox-thumbnail', vars.thumbnails).removeClass('ilightbox-active').eq(item).addClass('ilightbox-active');
iL.positionThumbnails();
if(iL.items[item]){
if(!iL.items[item].options.mousewheel) vars.lockWheel=true;
else vars.lockWheel=false;
if(!iL.items[item].options.swipe) vars.lockSwipe=true;
else vars.lockSwipe=false;
}
vars.isSwipe=false;
if(['iframe', 'video'].indexOf(iL.items[vars.current].type)!==-1){
$('div.ilightbox-container', secondHolder).empty();
}
if(side=="next"){
vars.nextPhoto=lastHolder,
vars.prevPhoto=secondHolder,
vars.holder=firstHolder;
vars.nextPhoto.hide();
vars.next=vars.next + 1,
vars.prev=vars.current,
vars.current=vars.current + 1;
if(opts.infinite){
if(vars.current > vars.total - 1) vars.current=0;
if(vars.current==vars.total - 1) vars.next=0;
if(vars.current==0) vars.prev=vars.total - 1;
}
iL.createUI();
if(!iL.items[vars.next])
vars.nextLock=false;
else
iL.loadContent(iL.items[vars.next], 'next');
}else{
vars.prevPhoto=lastHolder;
vars.nextPhoto=secondHolder;
vars.holder=firstHolder;
vars.prevPhoto.hide();
vars.next=vars.current;
vars.current=vars.prev;
vars.prev=vars.current - 1;
if(opts.infinite){
if(vars.current==vars.total - 1) vars.next=0;
if(vars.current==0) vars.prev=vars.total - 1;
}
iL.createUI();
if(!iL.items[vars.prev])
vars.prevLock=false;
else
iL.loadContent(iL.items[vars.prev], 'prev');
}
if(['iframe', 'video'].indexOf(iL.items[vars.current].type)!==-1){
iL.loadContent(iL.items[vars.current], 'current');
}
if(opts.linkId) setTimeout(function(){
vars.hashLock=false;
}, 55);
if(!opts.infinite){
vars.nextButton.add(vars.prevButton).add(vars.innerPrevButton).add(vars.innerNextButton).removeClass('disabled');
if(vars.current==0)
vars.prevButton.add(vars.innerPrevButton).addClass('disabled');
if(vars.current >=vars.total - 1)
vars.nextButton.add(vars.innerNextButton).addClass('disabled');
}
iL.repositionPhoto();
iL.resetCycle();
if(typeof opts.callback.onAfterChange=='function')
opts.callback.onAfterChange.call(iL, iL.ui);
});
top=(path=='horizontal') ? getPixel(lastHolder, 'top'):((side=="next") ? parseInt(-(winH / 2) - lastHolder.outerHeight()):parseInt(top * 2)),
left=(path=='horizontal') ? ((side=="next") ? parseInt(-(winW / 2) - lastHolder.outerWidth()):parseInt(left * 2)):getPixel(lastHolder, 'left');
lastHolder.css(transform, gpuAcceleration).animate({
top: top,
left: left,
opacity: opts.styles.nextOpacity
}, switchSpeed, (vars.isSwipe) ? 'easeOutCirc':'easeInOutCirc', function(){
lastHolder.css(transform, '');
}).addClass(secondClass);
}},
setCaption: function(obj, target){
var iL=this,
caption=$('
');
if(obj.caption){
caption.html(obj.caption);
$('div.ilightbox-container', target).append(caption);
}},
normalizeSocial: function(obj, url){
var iL=this,
vars=iL.vars,
opts=iL.options,
baseURL=window.location.href;
$.each(obj, function(key, value){
if(!value)
return true;
var item=key.toLowerCase(),
source, text;
switch (item){
case 'facebook':
source="http://www.facebook.com/share.php?v=4&src=bm&u={URL}",
text="Share on Facebook";
break;
case 'twitter':
source="http://twitter.com/home?status={URL}",
text="Share on Twitter";
break;
case 'googleplus':
source="https://plus.google.com/share?url={URL}",
text="Share on Google+";
break;
case 'delicious':
source="http://delicious.com/post?url={URL}",
text="Share on Delicious";
break;
case 'digg':
source="http://digg.com/submit?phase=2&url={URL}",
text="Share on Digg";
break;
case 'reddit':
source="http://reddit.com/submit?url={URL}",
text="Share on reddit";
break;
}
obj[key]={
URL: value.URL&&absolutizeURI(baseURL, value.URL)||opts.linkId&&window.location.href||typeof url!=='string'&&baseURL||url&&absolutizeURI(baseURL, url)||baseURL,
source: value.source||source||value.URL&&absolutizeURI(baseURL, value.URL)||url&&absolutizeURI(baseURL, url),
text: value.text||text||"Share on " + key,
width: (typeof(value.width)!='undefined'&&!isNaN(value.width)) ? parseInt(value.width):640,
height: value.height||360
};});
return obj;
},
setSocial: function(obj, url, target){
var iL=this,
socialBar=$('
'),
buttons='';
obj=iL.normalizeSocial(obj, url);
$.each(obj, function(key, value){
var item=key.toLowerCase(),
source=value.source.replace(/\{URL\}/g, encodeURIComponent(value.URL).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'));
buttons +=' ';
});
buttons +=' ';
socialBar.html(buttons);
$('div.ilightbox-container', target).append(socialBar);
},
fullScreenAction: function(){
var iL=this,
vars=iL.vars;
if(fullScreenApi.supportsFullScreen){
if(fullScreenApi.isFullScreen()) fullScreenApi.cancelFullScreen(document.documentElement);
else fullScreenApi.requestFullScreen(document.documentElement);
}else{
iL.doFullscreen();
}},
doFullscreen: function(){
var iL=this,
vars=iL.vars,
viewport=getViewport(),
opts=iL.options;
if(opts.fullAlone){
var currentHolder=vars.holder,
current=iL.items[vars.current],
windowWidth=viewport.width,
windowHeight=viewport.height,
elements=[currentHolder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.overlay, vars.toolbar, vars.thumbnails, vars.loader],
hideElements=[vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
if(!vars.isInFullScreen){
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=true;
vars.overlay.css({
opacity: 1
});
$.each(hideElements, function(i, element){
element.hide();
});
vars.fullScreenButton.attr('title', opts.text.exitFullscreen);
if(opts.fullStretchTypes.indexOf(current.type)!=-1) currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: windowWidth,
naturalHeight: windowHeight
});
else {
var viewport=current.options.fullViewPort||opts.fullViewPort||'',
newWidth=windowWidth,
newHeight=windowHeight,
width=currentHolder.data('naturalWidth'),
height=currentHolder.data('naturalHeight');
if(viewport.toLowerCase()=='fill'){
newHeight=(newWidth / width) * height;
if(newHeight < windowHeight){
newWidth=(windowHeight / height) * width,
newHeight=windowHeight;
}}else if(viewport.toLowerCase()=='fit'){
var dims=iL.getNewDimenstions(newWidth, newHeight, width, height, true);
newWidth=dims.width,
newHeight=dims.height;
}else if(viewport.toLowerCase()=='stretch'){
newWidth=newWidth,
newHeight=newHeight;
}else{
var scale=(width > newWidth||height > newHeight) ? true:false,
dims=iL.getNewDimenstions(newWidth, newHeight, width, height, scale);
newWidth=dims.width,
newHeight=dims.height;
}
currentHolder.data({
naturalWidthOld: currentHolder.data('naturalWidth'),
naturalHeightOld: currentHolder.data('naturalHeight'),
naturalWidth: newWidth,
naturalHeight: newHeight
});
}
$.each(elements, function(key, val){
val.addClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onEnterFullScreen=='function') opts.callback.onEnterFullScreen.call(iL, iL.ui);
}else{
vars.isInFullScreen=vars.lockKey=vars.lockWheel=vars.lockSwipe=false;
vars.overlay.css({
opacity: iL.options.overlay.opacity
});
$.each(hideElements, function(i, element){
element.show();
});
vars.fullScreenButton.attr('title', opts.text.enterFullscreen);
currentHolder.data({
naturalWidth: currentHolder.data('naturalWidthOld'),
naturalHeight: currentHolder.data('naturalHeightOld'),
naturalWidthOld: null,
naturalHeightOld: null
});
$.each(elements, function(key, val){
val.removeClass('ilightbox-fullscreen');
});
if(typeof opts.callback.onExitFullScreen=='function') opts.callback.onExitFullScreen.call(iL, iL.ui);
}}else{
if(!vars.isInFullScreen) vars.isInFullScreen=true;
else vars.isInFullScreen=false;
}
iL.repositionPhoto(true);
},
closeAction: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
$win.unbind('.iLightBox');
$doc.off('.iLightBox');
if(vars.isInFullScreen) fullScreenApi.cancelFullScreen(document.documentElement);
$('.ilightbox-overlay, .ilightbox-holder, .ilightbox-thumbnails').off('.iLightBox');
if(opts.hide.effect) vars.overlay.stop().fadeOut(opts.hide.speed, function(){
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
});
else {
vars.overlay.remove();
vars.BODY.removeClass('ilightbox-noscroll').off('.iLightBox');
}
var fadeOuts=[vars.toolbar, vars.holder, vars.nextPhoto, vars.prevPhoto, vars.nextButton, vars.prevButton, vars.loader, vars.thumbnails];
$.each(fadeOuts, function(i, element){
element.removeAttr('style').remove();
});
vars.dontGenerateThumbs=vars.isInFullScreen=false;
window.iLightBox=null;
if(opts.linkId){
vars.hashLock=true;
removeHash();
setTimeout(function(){
vars.hashLock=false;
}, 55);
}
if(typeof opts.callback.onHide=='function') opts.callback.onHide.call(iL, iL.ui);
},
repositionPhoto: function(){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
viewport=getViewport(),
winWidth=viewport.width,
winHeight=viewport.height;
if(viewport.width < UNCODE.mediaQuery) opts.styles.nextOffsetX=0;
var thumbsOffsetW=(vars.isInFullScreen&&opts.fullAlone||vars.isMobile) ? 0:((path=='horizontal') ? 0:vars.thumbnails.outerWidth()),
thumbsOffsetH=vars.isMobile ? vars.toolbar.outerHeight():((vars.isInFullScreen&&opts.fullAlone) ? 0:((path=='horizontal') ? vars.thumbnails.outerHeight():0)),
width=(vars.isInFullScreen&&opts.fullAlone) ? winWidth:(winWidth - (opts.styles.pageOffsetX)),
height=(vars.isInFullScreen&&opts.fullAlone) ? winHeight:(winHeight - (opts.styles.pageOffsetY)),
offsetW=(path=='horizontal') ? parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((width / 10) <=30) ? 30:(width / 10))):parseInt(((width / 10) <=30) ? 30:(width / 10)) + thumbsOffsetW,
offsetH=(path=='horizontal') ? parseInt(((height / 10) <=30) ? 30:(height / 10)) + thumbsOffsetH:parseInt((iL.items[vars.next]||iL.items[vars.prev]) ? ((opts.styles.nextOffsetX + opts.styles.prevOffsetX)) * 2:(((height / 10) <=30) ? 30:(height / 10)));
var elObject={
type: 'current',
width: width,
height: height,
item: iL.items[vars.current],
offsetW: offsetW,
offsetH: offsetH,
thumbsOffsetW: thumbsOffsetW,
thumbsOffsetH: thumbsOffsetH,
animate: arguments.length,
holder: vars.holder
};
iL.repositionEl(elObject);
if(iL.items[vars.next]){
elObject=$.extend(elObject, {
type: 'next',
item: iL.items[vars.next],
offsetX: opts.styles.nextOffsetX,
offsetY: opts.styles.nextOffsetY,
holder: vars.nextPhoto
});
iL.repositionEl(elObject);
}
if(iL.items[vars.prev]){
elObject=$.extend(elObject, {
type: 'prev',
item: iL.items[vars.prev],
offsetX: opts.styles.nextOffsetX,
offsetY: opts.styles.prevOffsetY,
holder: vars.prevPhoto
});
iL.repositionEl(elObject);
}
var loaderCss=(path=="horizontal") ? {
left: parseInt((width / 2) - (vars.loader.outerWidth() / 2))
}:{
top: parseInt((height / 2) - (vars.loader.outerHeight() / 2))
};
vars.loader.css(loaderCss);
},
repositionEl: function(obj){
var iL=this,
vars=iL.vars,
opts=iL.options,
path=opts.path.toLowerCase(),
widthAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.width:(obj.width - obj.offsetW)):(obj.width - obj.offsetW),
heightAvail=(obj.type=='current') ? ((vars.isInFullScreen&&opts.fullAlone) ? obj.height:(obj.height - obj.offsetH)):(obj.height - obj.offsetH),
itemParent=obj.item,
item=obj.item.options,
holder=obj.holder,
offsetX=obj.offsetX||0,
offsetY=obj.offsetY||0,
thumbsOffsetW=obj.thumbsOffsetW,
thumbsOffsetH=obj.thumbsOffsetH;
if(obj.type=='current'){
if(typeof item.width=='number'&&item.width) widthAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? widthAvail:((item.width > widthAvail) ? widthAvail:item.width);
if(typeof item.height=='number'&&item.height) heightAvail=((vars.isInFullScreen&&opts.fullAlone)&&(opts.fullStretchTypes.indexOf(itemParent.type)!=-1||item.fullViewPort||opts.fullViewPort)) ? heightAvail:((item.height > heightAvail) ? heightAvail:item.height);
}else{
if(typeof item.width=='number'&&item.width) widthAvail=(item.width > widthAvail) ? widthAvail:item.width;
if(typeof item.height=='number'&&item.height) heightAvail=(item.height > heightAvail) ? heightAvail:item.height;
}
heightAvail=parseInt(heightAvail - $('.ilightbox-inner-toolbar', holder).outerHeight());
var width=(typeof item.width=='string'&&item.width.indexOf('%')!=-1) ? percentToValue(parseInt(item.width.replace('%', '')), obj.width):holder.data('naturalWidth'),
height=(typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? percentToValue(parseInt(item.height.replace('%', '')), obj.height):holder.data('naturalHeight');
var dims=((typeof item.width=='string'&&item.width.indexOf('%')!=-1||typeof item.height=='string'&&item.height.indexOf('%')!=-1) ? {
width: width,
height: height
}:iL.getNewDimenstions(widthAvail, heightAvail, width, height)),
newDims=$.extend({}, dims, {});
if(obj.type=='prev'||obj.type=='next')
width=parseInt(dims.width * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale)),
height=parseInt(dims.height * ((obj.type=='next') ? opts.styles.nextScale:opts.styles.prevScale));
else
width=dims.width,
height=dims.height;
var widthDiff=parseInt((getPixel(holder, 'padding-left') + getPixel(holder, 'padding-right') + getPixel(holder, 'border-left-width') + getPixel(holder, 'border-right-width')) / 2),
heightDiff=parseInt((getPixel(holder, 'padding-top') + getPixel(holder, 'padding-bottom') + getPixel(holder, 'border-top-width') + getPixel(holder, 'border-bottom-width') + ($('.ilightbox-inner-toolbar', holder).outerHeight()||0)) / 2);
switch (obj.type){
case 'current':
var top=parseInt((obj.height / 2) - (height / 2) - heightDiff - (thumbsOffsetH / 2)),
left=parseInt((obj.width / 2) - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
case 'next':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(obj.height - offsetX - heightDiff - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(obj.width - offsetX - widthDiff - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - (width / 2) - widthDiff - offsetY - (thumbsOffsetW / 2));
break;
case 'prev':
var top=(path=='horizontal') ? parseInt((obj.height / 2) - offsetY - (height / 2) - heightDiff - (thumbsOffsetH / 2)):parseInt(offsetX - heightDiff - height - (thumbsOffsetH / 2)),
left=(path=='horizontal') ? parseInt(offsetX - widthDiff - width - (thumbsOffsetW / 2)):parseInt((obj.width / 2) - offsetY - (width / 2) - widthDiff - (thumbsOffsetW / 2));
break;
}
holder.data('offset', {
top: top,
left: left,
newDims: newDims,
diff: {
W: widthDiff,
H: heightDiff
},
thumbsOffset: {
W: thumbsOffsetW,
H: thumbsOffsetH
},
object: obj
});
var opacityMobile;
if(isMobile){
opacityMobile={
opacity: 1,
top: top,
left: left
};}else{
opacityMobile={
top: top,
left: left
};}
if(obj.animate > 0&&opts.effects.reposition){
holder.css(transform, gpuAcceleration).stop().animate(opacityMobile,
opts.effects.repositionSpeed, 'easeOutCirc', function(){
holder.css(transform, '');
});
$('div.ilightbox-container', holder).stop().animate({
width: width,
height: height
}, opts.effects.repositionSpeed, 'easeOutCirc');
$('div.ilightbox-inner-toolbar', holder).stop().animate({
width: width
}, opts.effects.repositionSpeed, 'easeOutCirc', function(){
$(this).css('overflow', 'visible');
});
}else{
holder.css(opacityMobile);
$('div.ilightbox-container', holder).css({
width: width,
height: height
});
$('div.ilightbox-inner-toolbar', holder).css({
width: width
});
}},
resume: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(!opts.slideshow.pauseTime||opts.controls.slideshow&&vars.total <=1||priority < vars.isPaused){
return;
}
vars.isPaused=0;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}
vars.cycleID=setTimeout(function(){
if(vars.current==vars.total - 1) iL.goTo(0);
else iL.moveTo('next');
}, opts.slideshow.pauseTime);
},
pause: function(priority){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(priority < vars.isPaused){
return;
}
vars.isPaused=priority||100;
if(vars.cycleID){
vars.cycleID=clearTimeout(vars.cycleID);
}},
resetCycle: function(){
var iL=this,
vars=iL.vars,
opts=iL.options;
if(opts.controls.slideshow&&vars.cycleID&&!vars.isPaused){
iL.resume();
}},
getNewDimenstions: function(width, height, width_old, height_old, thumb){
var iL=this;
if(!width) factor=height / height_old;
else if(!height) factor=width / width_old;
else factor=min(width / width_old, height / height_old);
if(!thumb){
if(factor > iL.options.maxScale) factor=iL.options.maxScale;
else if(factor < iL.options.minScale) factor=iL.options.minScale;
}
var final_width=(iL.options.keepAspectRatio) ? round(width_old * factor):width,
final_height=(iL.options.keepAspectRatio) ? round(height_old * factor):height;
return {
width: final_width,
height: final_height,
ratio: factor
};},
setOption: function(options){
var iL=this;
iL.options=$.extend(true, iL.options, options||{});
iL.refresh();
},
availPlugins: function(){
var iL=this,
testEl=document.createElement("video");
iL.plugins={
flash: !isMobile,
quicktime: (parseInt(PluginDetect.getVersion("QuickTime")) >=0) ? true:false,
html5H264: !!(testEl.canPlayType&&testEl.canPlayType('video/mp4').replace(/no/, '')),
html5WebM: !!(testEl.canPlayType&&testEl.canPlayType('video/webm').replace(/no/, '')),
html5Vorbis: !!(testEl.canPlayType&&testEl.canPlayType('video/ogg').replace(/no/, '')),
html5QuickTime: !!(testEl.canPlayType&&testEl.canPlayType('video/quicktime').replace(/no/, ''))
};},
addContent: function(element, obj){
var iL=this,
el;
switch (obj.type){
case 'video':
var HTML5=false,
videoType=obj.videoType,
html5video=obj.options.html5video;
if(((videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')||html5video.h264)&&iL.plugins.html5H264)
obj.ext='mp4',
obj.URL=html5video.h264||obj.URL;
else if(html5video.webm&&iL.plugins.html5WebM)
obj.ext='webm',
obj.URL=html5video.webm||obj.URL;
else if(html5video.ogg&&iL.plugins.html5Vorbis)
obj.ext='ogv',
obj.URL=html5video.ogg||obj.URL;
if(iL.plugins.html5H264&&(videoType=='video/mp4'||obj.ext=='mp4'||obj.ext=='m4v')) HTML5=true, videoType="video/mp4";
else if(iL.plugins.html5WebM&&(videoType=='video/webm'||obj.ext=='webm')) HTML5=true, videoType="video/webm";
else if(iL.plugins.html5Vorbis&&(videoType=='video/ogg'||obj.ext=='ogv')) HTML5=true, videoType="video/ogg";
else if(iL.plugins.html5QuickTime&&(videoType=='video/quicktime'||obj.ext=='mov'||obj.ext=='qt')) HTML5=true, videoType="video/quicktime";
if(HTML5){
el=$(' ', {
"width": "100%",
"height": "100%",
"preload": html5video.preload,
"autoplay": html5video.autoplay,
"loop": html5video.loop,
"poster": html5video.poster,
"controls": html5video.controls,
"controlslist": "nodownload"
}).append($(' ', {
"src": obj.URL,
"type": videoType
}));
}else{
if(!iL.plugins.quicktime) el=$(' ', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.quicktime).replace('{type}', 'QuickTime')
});
else {
el=$(' ', {
"type": "video/quicktime",
"pluginspage": pluginspages.quicktime
}).attr({
"data": obj.URL,
"width": "100%",
"height": "100%"
}).append($(' ', {
"name": "src",
"value": obj.URL
})).append($(' ', {
"name": "autoplay",
"value": "false"
})).append($(' ', {
"name": "loop",
"value": "false"
})).append($(' ', {
"name": "scale",
"value": "tofit"
}));
if(browser.msie) el=QT_GenerateOBJECTText(obj.URL, '100%', '100%', '', 'SCALE', 'tofit', 'AUTOPLAY', 'false', 'LOOP', 'false');
}}
break;
case 'flash':
if(!iL.plugins.flash) el=$(' ', {
"class": "ilightbox-alert",
html: iL.options.errors.missingPlugin.replace('{pluginspage}', pluginspages.flash).replace('{type}', 'Adobe Flash player')
});
else {
var flashvars="",
i=0;
if(obj.options.flashvars) $.each(obj.options.flashvars, function(k, v){
if(i!=0) flashvars +="&";
flashvars +=k + "=" + encodeURIComponent(v);
i++;
});
else flashvars=null;
el=$(' ').attr({
"type": "application/x-shockwave-flash",
"src": obj.URL,
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
"quality": "high",
"bgcolor": "#000000",
"play": "true",
"loop": "true",
"menu": "true",
"wmode": "transparent",
"scale": "showall",
"allowScriptAccess": "always",
"allowFullScreen": "true",
"flashvars": flashvars,
"fullscreen": "yes"
});
}
break;
case 'iframe':
el=$('').attr({
"width": (typeof obj.options.width=='number'&&obj.options.width&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.width:"100%",
"height": (typeof obj.options.height=='number'&&obj.options.height&&iL.options.minScale=='1'&&iL.options.maxScale=='1') ? obj.options.height:"100%",
src: obj.URL,
frameborder: 0,
'hspace': 0,
'vspace': 0,
'scrolling': supportTouch ? 'auto':'scroll',
'webkitAllowFullScreen': '',
'mozallowfullscreen': '',
'allowFullScreen': ''
});
break;
case 'inline':
el=$('
').html($(obj.URL).clone(true));
break;
case 'html':
var object=obj.URL,
el;
if(object[0].nodeName){
el=$('
').html(object);
}else{
var dom=$(obj.URL),
html=(dom.selector) ? $('' + dom + '
'):dom;
el=$('
').html(html);
}
break;
}
$('div.ilightbox-container', element).empty().html(el);
if(el[0].tagName.toLowerCase()==='video'&&browser.webkit) setTimeout(function(){
var src=el[0].currentSrc + '?' + floor(random() * 30000);
el[0].currentSrc=src;
el[0].src=src;
});
return el;
},
ogpRecognition: function(obj, callback){
var iL=this,
url=obj.URL;
iL.showLoader();
doAjax(url, function(data){
iL.hideLoader();
if(data){
var object=new Object();
object.length=false,
object.url=data.url;
if(data.status==200){
var result=data.results,
type=result.type,
source=result.source;
object.source=source.src,
object.width=source.width&&parseInt(source.width)||0,
object.height=source.height&&parseInt(source.height)||0,
object.type=type,
object.thumbnail=source.thumbnail||result.images&&result.images[0],
object.html5video=result.html5video||{},
object.length=true;
if(source.type=='application/x-shockwave-flash') object.type="flash";
else if(source.type.indexOf("video/")!=-1) object.type="video";
else if(source.type.indexOf("/html")!=-1) object.type="iframe";
else if(source.type.indexOf("image/")!=-1) object.type="image";
}else if(typeof data.response!='undefined')
throw data.response;
callback.call(this, object.length ? object:false);
}});
},
hashChangeHandler: function(url){
var iL=this,
vars=iL.vars,
opts=iL.options,
URL=url||window.location.href,
hash=parseURI(URL).hash,
split=hash.split('/'),
index=split[1];
if(vars.hashLock||('#' + opts.linkId!=split[0]&&hash.length > 1)) return;
if(index){
var target=split[1]||0;
if(iL.items[target]){
var overlay=$('.ilightbox-overlay');
if(overlay.length&&overlay.attr('linkid')==opts.linkId){
iL.goTo(target);
}else{
iL.itemsObject[target].trigger(supportTouch ? 'itap':'click');
}}else{
var overlay=$('.ilightbox-overlay');
if(overlay.length) iL.closeAction();
}}else{
var overlay=$('.ilightbox-overlay');
if(overlay.length) iL.closeAction();
}}
};
function getPixel($element, property){
return parseInt($element.css(property), 10)||0;
}
function within(number, min, max){
return number < min ? min:number > max ? max:number;
}
function getViewport(){
var e=window,
a='inner';
if(!('innerWidth' in window)){
a='client';
e=document.documentElement||document.body;
}
return {
width: e[a + 'Width'],
height: e[a + 'Height']
}}
function removeHash(){
var scroll=getScrollXY();
history.pushState("", document.title, window.location.pathname + window.location.search);
window.scrollTo(scroll.x, scroll.y);
}
function doAjax(url, callback){
var url="//ilightbox.net/getSource/jsonp.php?url=" + encodeURIComponent(url).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A');
$.ajax({
url: url,
dataType: 'jsonp'
});
iLCallback=function(data){
callback.call(this, data);
};}
function findImageInElement(element){
var elements=$('*', element),
imagesArr=new Array();
elements.each(function(){
var url="",
element=this;
if($(element).css("background-image")!="none"){
url=$(element).css("background-image");
}else if(typeof($(element).attr("src"))!="undefined"&&element.nodeName.toLowerCase()=="img"){
url=$(element).attr("src");
}
if(url.indexOf("gradient")==-1){
url=url.replace(/url\(\"/g, "");
url=url.replace(/url\(/g, "");
url=url.replace(/\"\)/g, "");
url=url.replace(/\)/g, "");
var urls=url.split(",");
for (var i=0; i < urls.length; i++){
if(urls[i].length > 0&&$.inArray(urls[i], imagesArr)==-1){
var extra="";
if(browser.msie&&browser.version < 9){
extra="?" + floor(random() * 3000);
}
imagesArr.push(urls[i] + extra);
}}
}});
return imagesArr;
}
function getExtension(URL){
if(URL!==null){
var ext=URL.indexOf('?')!==-1 ? URL.split('?')[0]:URL;
ext=ext.split('.').pop().toLowerCase();
return ext;
}}
function getTypeByExtension(URL){
var type,
ext=getExtension(URL);
if(extensions.image.indexOf(ext)!==-1) type='image';
else if(extensions.flash.indexOf(ext)!==-1) type='flash';
else if(extensions.video.indexOf(ext)!==-1) type='video';
else if(ext.substring(0, 1)=="#") type='inline';
else type='iframe';
return type;
}
function percentToValue(percent, total){
return parseInt((total / 100) * percent);
}
function parseURI(url){
var m=String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
return (m ? {
href: m[0]||'',
protocol: m[1]||'',
authority: m[2]||'',
host: m[3]||'',
hostname: m[4]||'',
port: m[5]||'',
pathname: m[6]||'',
search: m[7]||'',
hash: m[8]||''
}:null);
}
function absolutizeURI(base, href){
var iL=this;
function removeDotSegments(input){
var output=[];
input.replace(/^(\.\.?(\/|$))+/, '')
.replace(/\/(\.(\/|$))+/g, '/')
.replace(/\/\.\.$/, '/../')
.replace(/\/?[^\/]*/g, function(p){
if(p==='/..'){
output.pop();
}else{
output.push(p);
}});
return output.join('').replace(/^\//, input.charAt(0)==='/' ? '/':'');
}
href=parseURI(href||'');
base=parseURI(base||'');
return !href||!base ? null:(href.protocol||base.protocol) +
(href.protocol||href.authority ? href.authority:base.authority) +
removeDotSegments(href.protocol||href.authority||href.pathname.charAt(0)==='/' ? href.pathname:(href.pathname ? ((base.authority&&!base.pathname ? '/':'') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname):base.pathname)) +
(href.protocol||href.authority||href.pathname ? href.search:(href.search||base.search)) +
href.hash;
}
function version_compare(v1, v2, operator){
this.php_js=this.php_js||{};
this.php_js.ENV=this.php_js.ENV||{};
var i=0,
x=0,
compare=0,
vm={
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
prepVersion=function(v){
v=('' + v).replace(/[_\-+]/g, '.');
v=v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8]:v.split('.'));
},
numVersion=function(v){
return !v ? 0:(isNaN(v) ? vm[v]||-7:parseInt(v, 10));
};
v1=prepVersion(v1);
v2=prepVersion(v2);
x=max(v1.length, v2.length);
for (i=0; i < x; i++){
if(v1[i]==v2[i]){
continue;
}
v1[i]=numVersion(v1[i]);
v2[i]=numVersion(v2[i]);
if(v1[i] < v2[i]){
compare=-1;
break;
}else if(v1[i] > v2[i]){
compare=1;
break;
}}
if(!operator){
return compare;
}
switch (operator){
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >=0);
case '<=':
case 'le':
return (compare <=0);
case '==':
case '=':
case 'eq':
return (compare===0);
case '<>':
case '!=':
case 'ne':
return (compare!==0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}}
$.fn.iLightBox=function(){
var args=arguments,
opt=($.isPlainObject(args[0])) ? args[0]:args[1],
items=($.isArray(args[0])||typeof args[0]=='string') ? args[0]:args[1];
if(!opt) opt={};
var options=$.extend(true, {
attr: 'href',
path: 'vertical',
skin: 'dark',
linkId: false,
infinite: false,
startFrom: 0,
randomStart: false,
keepAspectRatio: true,
maxScale: 1,
minScale: .2,
innerToolbar: false,
smartRecognition: false,
mobileOptimizer: true,
fullAlone: true,
fullViewPort: null,
fullStretchTypes: 'flash, video',
overlay: {
blur: true,
opacity: .85
},
controls: {
arrows: false,
slideshow: false,
toolbar: true,
fullscreen: true,
thumbnail: true,
keyboard: true,
mousewheel: true,
swipe: true
},
keyboard: {
left: true,
right: true,
up: true,
down: true,
esc: true,
shift_enter: true
},
show: {
effect: true,
speed: 300,
title: true
},
hide: {
effect: true,
speed: 300
},
caption: {
start: true,
show: 'mouseenter',
hide: 'mouseleave'
},
social: {
start: true,
show: 'mouseenter',
hide: 'mouseleave',
buttons: false
},
styles: {
pageOffsetX: 0,
pageOffsetY: 0,
nextOffsetX: 45,
nextOffsetY: 0,
nextOpacity: 1,
nextScale: 1,
prevOffsetX: 45,
prevOffsetY: 0,
prevOpacity: 1,
prevScale: 1
},
thumbnails: {
maxWidth: 120,
maxHeight: 80,
normalOpacity: 1,
activeOpacity: .6
},
effects: {
reposition: true,
repositionSpeed: 200,
switchSpeed: 500,
loadedFadeSpeed: 180,
fadeSpeed: 200
},
slideshow: {
pauseTime: 5000,
pauseOnHover: false,
startPaused: true
},
text: {
close: "Press Esc to close",
enterFullscreen: "Enter Fullscreen (Shift+Enter)",
exitFullscreen: "Exit Fullscreen (Shift+Enter)",
slideShow: "Slideshow",
next: "Next",
previous: "Previous"
},
errors: {
loadImage: "An error occurred when trying to load photo.",
loadContents: "An error occurred when trying to load contents.",
missingPlugin: "The content your are attempting to view requires the {type} plugin<\/a>."
},
ajaxSetup: {
url: '',
beforeSend: function(jqXHR, settings){},
cache: false,
complete: function(jqXHR, textStatus){},
crossDomain: false,
error: function(jqXHR, textStatus, errorThrown){},
success: function(data, textStatus, jqXHR){},
global: true,
ifModified: false,
username: null,
password: null,
type: 'GET'
},
callback: {}}, opt);
var instant=($.isArray(items)||typeof items=='string') ? true:false;
items=$.isArray(items) ? items:new Array();
if(typeof args[0]=='string') items[0]=args[0];
if(version_compare($.fn.jquery, '1.8', '>=')){
var iLB=new iLightBox($(this), options, items, instant);
return {
close: function(){
iLB.closeAction();
},
fullscreen: function(){
iLB.fullScreenAction();
},
moveNext: function(){
iLB.moveTo('next');
},
movePrev: function(){
iLB.moveTo('prev');
},
goTo: function(index){
iLB.goTo(index);
},
refresh: function(){
iLB.refresh();
},
reposition: function(){
(arguments.length > 0) ? iLB.repositionPhoto(true): iLB.repositionPhoto();
},
setOption: function(options){
iLB.setOption(options);
},
destroy: function(){
iLB.closeAction();
iLB.dispatchItemsEvents();
}};}else{
throw "The jQuery version that was loaded is too old. iLightBox requires jQuery 1.8+";
}};
$.iLightBox=function(){
return $.fn.iLightBox(arguments[0], arguments[1]);
};
$.extend($.easing, {
easeInCirc: function(x, t, b, c, d){
return -c * (sqrt(1 - (t /=d) * t) - 1) + b;
},
easeOutCirc: function(x, t, b, c, d){
return c * sqrt(1 - (t=t / d - 1) * t) + b;
},
easeInOutCirc: function(x, t, b, c, d){
if((t /=d / 2) < 1) return -c / 2 * (sqrt(1 - t * t) - 1) + b;
return c / 2 * (sqrt(1 - (t -=2) * t) + 1) + b;
}});
function getScrollXY(){
var scrOfX=0,
scrOfY=0;
if(typeof(window.pageYOffset)=='number'){
scrOfY=window.pageYOffset;
scrOfX=window.pageXOffset;
}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){
scrOfY=document.body.scrollTop;
scrOfX=document.body.scrollLeft;
}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
scrOfY=document.documentElement.scrollTop;
scrOfX=document.documentElement.scrollLeft;
}
return {
x: scrOfX,
y: scrOfY
};}
(function(){
$.each(("touchstart touchmove touchend " +
"tap taphold " +
"swipe swipeleft swiperight " +
"scrollstart scrollstop").split(" "), function(i, name){
$.fn[name]=function(fn){
return fn ? this.bind(name, fn):this.trigger(name);
};});
var tapSettings={
startEvent: 'touchstart.iTap',
endEvent: 'touchend.iTap'
};
$.event.special.itap={
setup: function(){
var self=this,
$self=$(this),
start, stop;
$self.bind(tapSettings.startEvent, function(event){
start=getScrollXY();
$self.one(tapSettings.endEvent, function(event){
stop=getScrollXY();
var orgEvent=event||window.event;
event=$.event.fix(orgEvent);
event.type="itap";
if((start&&stop)&&(start.x==stop.x&&start.y==stop.y))($.event.dispatch||$.event.handle).call(self, event);
start=stop=undefined;
});
});
},
teardown: function(){
$(this).unbind(tapSettings.startEvent);
}};}());
(function(){
fullScreenApi={
supportsFullScreen: false,
isFullScreen: function(){
return false;
},
requestFullScreen: function(){},
cancelFullScreen: function(){},
fullScreenEventName: '',
prefix: ''
},
browserPrefixes='webkit moz o ms khtml'.split(' ');
if(typeof document.cancelFullScreen!='undefined'){
fullScreenApi.supportsFullScreen=true;
}else{
for (var i=0, il=browserPrefixes.length; i < il; i++){
fullScreenApi.prefix=browserPrefixes[i];
if(typeof document[fullScreenApi.prefix + 'CancelFullScreen']!='undefined'){
fullScreenApi.supportsFullScreen=true;
break;
}}
}
if(fullScreenApi.supportsFullScreen){
fullScreenApi.fullScreenEventName=fullScreenApi.prefix + 'fullscreenchange';
fullScreenApi.isFullScreen=function(){
switch (this.prefix){
case '':
return document.fullScreen;
case 'webkit':
return document.webkitIsFullScreen;
default:
return document[this.prefix + 'FullScreen'];
}}
fullScreenApi.requestFullScreen=function(el){
return (this.prefix==='') ? el.requestFullScreen():el[this.prefix + 'RequestFullScreen']();
}
fullScreenApi.cancelFullScreen=function(el){
return (this.prefix==='') ? document.cancelFullScreen():document[this.prefix + 'CancelFullScreen']();
}}
}());
(function(){
function uaMatch(ua){
ua=ua.toLowerCase();
var match=/(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua)||[];
return {
browser: match[1]||"",
version: match[2]||"0"
};}
var matched=uaMatch(navigator.userAgent);
browser={};
if(matched.browser){
browser[matched.browser]=true;
browser.version=matched.version;
}
if(browser.chrome){
browser.webkit=true;
}else if(browser.webkit){
browser.safari=true;
}}());
(function(){
var prefixes=['', 'webkit', 'moz', 'ms', 'o'];
var el=document.createElement('div');
function testProp(prop){
for (var p=0, pl=prefixes.length; p < pl; p++){
var prefixedProp=prefixes[p] ? prefixes[p] + prop.charAt(0).toUpperCase() + prop.slice(1):prop;
if(el.style[prefixedProp]!==undefined){
return prefixedProp;
}}
}
transform=testProp('transform')||'';
gpuAcceleration=testProp('perspective') ? 'translateZ(0) ':'';
}());
var PluginDetect={version:"0.7.9",name:"PluginDetect",handler:function(c,b,a){return function(){c(b,a)}},openTag:"<",isDefined:function(b){return typeof b!="undefined"},isArray:function(b){return(/array/i).test(Object.prototype.toString.call(b))},isFunc:function(b){return typeof b=="function"},isString:function(b){return typeof b=="string"},isNum:function(b){return typeof b=="number"},isStrNum:function(b){return(typeof b=="string"&&(/\d/).test(b))},getNumRegx:/[\d][\d\.\_,-]*/,splitNumRegx:/[\.\_,-]/g,getNum:function(b,c){var d=this,a=d.isStrNum(b)?(d.isDefined(c)?new RegExp(c):d.getNumRegx).exec(b):null;return a?a[0]:null},compareNums:function(h,f,d){var e=this,c,b,a,g=parseInt;if(e.isStrNum(h)&&e.isStrNum(f)){if(e.isDefined(d)&&d.compareNums){return d.compareNums(h,f)}c=h.split(e.splitNumRegx);b=f.split(e.splitNumRegx);for(a=0;ag(b[a],10)){return 1}if(g(c[a],10)c||!(/\d/).test(e[a])){e[a]="0"}}return e.slice(0,4).join(",")},$$hasMimeType:function(a){return function(c){if(!a.isIE&&c){var f,e,b,d=a.isArray(c)?c:(a.isString(c)?[c]:[]);for(b=0;b2||!f||!f.version||!(e=h.getNum(f.version))){return b}if(!b){return e}e=h.formatNum(e);b=h.formatNum(b);d=b.split(h.splitNumRegx);g=e.split(h.splitNumRegx);for(a=0;a-1&&a>c&&d[a]!="0"){return b}if(g[a]!=d[a]){if(c==-1){c=a}if(d[a]!="0"){return b}}}return e},AXO:window.ActiveXObject,getAXO:function(a){var f=null,d,b=this,c={};try{f=new b.AXO(a)}catch(d){}return f},convertFuncs:function(f){var a,g,d,b=/^[\$][\$]/,c=this;for(a in f){if(b.test(a)){try{g=a.slice(2);if(g.length>0&&!f[g]){f[g]=f[a](f);delete f[a]}}catch(d){}}}},initObj:function(e,b,d){var a,c;if(e){if(e[b[0]]==1||d){for(a=0;a=0;h=h-2){if(g[h]&&new RegExp(g[h],"i").test(b)){d.OS=g[h+1];break}}};d.head=i.getElementsByTagName("head")[0]||i.getElementsByTagName("body")[0]||i.body||null;d.isIE=new Function("return/*@cc_on!@*/!1")();d.verIE=d.isIE&&(/MSIE\s*(\d+\.?\d*)/i).test(l)?parseFloat(RegExp.$1,10):null;d.verIEfull=null;d.docModeIE=null;if(d.isIE){var f,n,c=document.createElement("div");try{c.style.behavior="url(#default#clientcaps)";d.verIEfull=(c.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid")).replace(/,/g,".")}catch(f){}n=parseFloat(d.verIEfull||"0",10);d.docModeIE=i.documentMode||((/back/i).test(i.compatMode||"")?5:n)||d.verIE;d.verIE=n||d.docModeIE};d.ActiveXEnabled=false;if(d.isIE){var h,m=["Msxml2.XMLHTTP","Msxml2.DOMDocument","Microsoft.XMLDOM","ShockwaveFlash.ShockwaveFlash","TDCCtl.TDCCtl","Shell.UIHelper","Scripting.Dictionary","wmplayer.ocx"];for(h=0;h0&&c.isFunc(b[0])))){a.push(b)}},callArray:function(b){var c=this,a;if(c.isArray(b)){for(a=0;a0&&b.isFunc(c[0])){c[0](b,a>1?c[1]:0,a>2?c[2]:0,a>3?c[3]:0)}else{if(b.isFunc(c)){c(b)}}},getVersionDelimiter:",",$$getVersion:function(a){return function(g,d,c){var e=a.init(g),f,b,h={};if(e.status<0){return null};f=e.plugin;if(f.getVersionDone!=1){f.getVersion(null,d,c);if(f.getVersionDone===null){f.getVersionDone=1}}a.cleanup();b=(f.version||f.version0);b=b?b.replace(a.splitNumRegx,a.getVersionDelimiter):b;return b}},cleanup:function(){var a=this;if(a.garbage&&a.isDefined(window.CollectGarbage)){window.CollectGarbage()}},isActiveXObject:function(d,b){var f=this,a=false,g,c='"+d.HTML+f.openTag+"/object>";if(!f.head){return a}f.head.insertBefore(document.createElement("object"),f.head.firstChild);f.head.firstChild.outerHTML=c;try{f.head.firstChild.classid=d.classID}catch(g){}try{if(f.head.firstChild.object){a=true}}catch(g){}try{if(a&&f.head.firstChild.readyState<4){f.garbage=true}}catch(g){}f.head.removeChild(f.head.firstChild);return a},codebaseSearch:function(f,b){var c=this;if(!c.ActiveXEnabled||!f){return null}if(f.BIfuncs&&f.BIfuncs.length&&f.BIfuncs[f.BIfuncs.length-1]!==null){c.callArray(f.BIfuncs)}var d,o=f.SEARCH,k={};if(c.isStrNum(b)){if(o.match&&o.min&&c.compareNums(b,o.min)<=0){return true}if(o.match&&o.max&&c.compareNums(b,o.max)>=0){return false}d=c.isActiveXObject(f,b);if(d&&(!o.min||c.compareNums(b,o.min)>0)){o.min=b}if(!d&&(!o.max||c.compareNums(b,o.max)<0)){o.max=b}return d};var e=[0,0,0,0],l=[].concat(o.digits),a=o.min?1:0,j,i,h,g,m,n=function(p,r){var q=[].concat(e);q[p]=r;return c.isActiveXObject(f,q.join(","))};if(o.max){g=o.max.split(c.splitNumRegx);for(j=0;je[0]){e[0]=m[0]}}if(m&&g){for(j=1;je[j]){e[j]=m[j]}}}if(o.max){for(j=1;j0&&l[j]==0&&l[j-1]=0;b--){c=d.div.childNodes[b];if(c&&c.childNodes){for(h=c.childNodes.length-1;h>=0;h--){g=c.childNodes[h];try{c.removeChild(g)}catch(f){}}}if(c){try{d.div.removeChild(c)}catch(f){}}}}if(!d.div){a=document.getElementById(d.divID);if(a){d.div=a}}if(d.div&&d.div.parentNode){try{d.div.parentNode.removeChild(d.div)}catch(f){}d.div=null}},DONEfuncs:[],onDoneEmptyDiv:function(){var c=this,a,b;if(!c.winLoaded){return}if(c.WLfuncs&&c.WLfuncs.length&&c.WLfuncs[c.WLfuncs.length-1]!==null){return}for(a in c){b=c[a];if(b&&b.funcs){if(b.OTF==3){return}if(b.funcs.length&&b.funcs[b.funcs.length-1]!==null){return}}}for(a=0;a=i){return -1}try{if(l==c.pluginSize&&(!c.isIE||c.getDOMobj(m).readyState==4)){if(!m.winLoaded&&c.winLoaded){return 1}if(m.winLoaded&&c.isNum(b)){if(!c.isNum(m.count)){m.count=b}if(b-m.count>=10){return 1}}}}catch(f){}return 0},getDOMobj:function(g,a){var f,d=this,c=g?g.span:0,b=c&&c.firstChild?1:0;try{if(b&&a){d.div.focus()}}catch(f){}return b?c.firstChild:null},setStyle:function(b,g){var f=b.style,a,d,c=this;if(f&&g){for(a=0;a.'+c.openTag+"/div>");b=d.getElementById(h)}catch(f){}}a=d.getElementsByTagName("body")[0]||d.body;if(a){a.insertBefore(i,a.firstChild);if(b){a.removeChild(b)}}},insertHTML:function(f,b,g,a,k){var l,m=document,j=this,p,o=m.createElement("span"),n,i;var c=["outlineStyle","none","borderStyle","none","padding","0px","margin","0px","visibility","visible"];var h="outline-style:none;border-style:none;padding:0px;margin:0px;visibility:visible;";if(!j.isDefined(a)){a=""}if(j.isString(f)&&(/[^\s]/).test(f)){f=f.toLowerCase().replace(/\s/g,"");p=j.openTag+f+' width="'+j.pluginSize+'" height="'+j.pluginSize+'" ';p+='style="'+h+'display:inline;" ';for(n=0;n";for(n=0;n '}}p+=a+j.openTag+"/"+f+">"}else{p=a}if(!j.div){i=m.getElementById(j.divID);if(i){j.div=i}else{j.div=m.createElement("div");j.div.id=j.divID}j.setStyle(j.div,c.concat(["width",j.divWidth+"px","height",(j.pluginSize+3)+"px","fontSize",(j.pluginSize+3)+"px","lineHeight",(j.pluginSize+3)+"px","verticalAlign","baseline","display","block"]));if(!i){j.setStyle(j.div,["position","absolute","right","0px","top","0px"]);j.insertDivInBody(j.div)}}if(j.div&&j.div.parentNode){j.setStyle(o,c.concat(["fontSize",(j.pluginSize+3)+"px","lineHeight",(j.pluginSize+3)+"px","verticalAlign","baseline","display","inline"]));try{o.innerHTML=p}catch(l){};try{j.div.appendChild(o)}catch(l){};return{span:o,winLoaded:j.winLoaded,tagName:f,outerHTML:p}}return{span:null,winLoaded:j.winLoaded,tagName:"",outerHTML:p}},Plugins:{quicktime:{mimeType:["video/quicktime","application/x-quicktimeplayer","image/x-macpaint","image/x-quicktime"],progID:"QuickTimeCheckObject.QuickTimeCheck.1",progID0:"QuickTime.QuickTime",classID:"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B",minIEver:7,HTML:' ',getCodeBaseVersion:function(a){return'codebase="#version='+a+'"'},SEARCH:{min:0,max:0,match:0,digits:[16,128,128,0]},getVersion:function(c){var f=this,d=f.$,a=null,e=null,b;if(!d.isIE){if(d.hasMimeType(f.mimeType)){e=d.OS!=3?d.findNavPlugin("QuickTime.*Plug-?in",0):null;if(e&&e.name){a=d.getNum(e.name)}}}else{if(d.isStrNum(c)){b=c.split(d.splitNumRegx);if(b.length>3&&parseInt(b[3],10)>0){b[3]="9999"}c=b.join(",")}if(d.isStrNum(c)&&d.verIE>=f.minIEver&&f.canUseIsMin()>0){f.installed=f.isMin(c);f.getVersionDone=0;return}f.getVersionDone=1;if(!a&&d.verIE>=f.minIEver){a=f.CDBASE2VER(d.codebaseSearch(f))}if(!a){e=d.getAXO(f.progID);if(e&&e.QuickTimeVersion){a=e.QuickTimeVersion.toString(16);a=parseInt(a.charAt(0),16)+"."+parseInt(a.charAt(1),16)+"."+parseInt(a.charAt(2),16)}}}f.installed=a?1:(e?0:-1);f.version=d.formatNum(a,3)},cdbaseUpper:["7,60,0,0","0,0,0,0"],cdbaseLower:["7,50,0,0",null],cdbase2ver:[function(c,b){var a=b.split(c.$.splitNumRegx);return[a[0],a[1].charAt(0),a[1].charAt(1),a[2]].join(",")},null],CDBASE2VER:function(f){var e=this,c=e.$,b,a=e.cdbaseUpper,d=e.cdbaseLower;if(f){f=c.formatNum(f);for(b=0;b=0&&e.cdbase2ver[b]){return e.cdbase2ver[b](e,f)}}}return f},canUseIsMin:function(){var f=this,d=f.$,b,c=f.canUseIsMin,a=f.cdbaseUpper,e=f.cdbaseLower;if(!c.value){c.value=-1;for(b=0;b2;h--){c=g.getAXO(j.progID+"."+h);if(c){a=h.toString();break}}if(!c){c=g.getAXO(j.progID)}if(a=="6"){try{c.AllowScriptAccess="always"}catch(k){return"6,0,21,0"}}try{l=b(c.GetVariable("$version"))}catch(k){}if(!l&&a){l=a}}j.installed=l?1:-1;j.version=g.formatNum(l);return true}},shockwave:{mimeType:"application/x-director",progID:"SWCtl.SWCtl",classID:"clsid:166B1BCA-3F9C-11CF-8075-444553540000",getVersion:function(){var a=null,b=null,g,f,d=this,c=d.$;if(!c.isIE){f=c.findNavPlugin("Shockwave\\s*for\\s*Director");if(f&&f.description&&c.hasMimeType(d.mimeType)){a=c.getNum(f.description)}if(a){a=c.getPluginFileVersion(f,a)}}else{try{b=c.getAXO(d.progID).ShockwaveVersion("")}catch(g){}if(c.isString(b)&&b.length>0){a=c.getNum(b)}else{if(c.getAXO(d.progID+".8")){a="8"}else{if(c.getAXO(d.progID+".7")){a="7"}else{if(c.getAXO(d.progID+".1")){a="6"}}}}}d.installed=a?1:-1;d.version=c.formatNum(a)}},zz:0}};PluginDetect.initScript();
var gArgCountErr='The "%%" function requires an even number of arguments.\nArguments should be in the form "atttributeName", "attributeValue", ...',gTagAttrs=null,gQTGeneratorVersion=1;function AC_QuickTimeVersion(){return gQTGeneratorVersion}function _QTComplain(a,b){b=b.replace("%%",a);alert(b)}function _QTAddAttribute(a,b,c){var d;d=gTagAttrs[a+b];null==d&&(d=gTagAttrs[b]);return null!=d?(0==b.indexOf(a)&&null==c&&(c=b.substring(a.length)),null==c&&(c=b),c+'="'+d+'" '):""}function _QTAddObjectAttr(a,b){if(0==a.indexOf("emb#"))return"";0==a.indexOf("obj#")&&null==b&&(b=a.substring(4));return _QTAddAttribute("obj#",a,b)}function _QTAddEmbedAttr(a,b){if(0==a.indexOf("obj#"))return"";0==a.indexOf("emb#")&&null==b&&(b=a.substring(4));return _QTAddAttribute("emb#",a,b)}function _QTAddObjectParam(a,b){var c,d="",e=b?" />":">";-1==a.indexOf("emb#")&&(c=gTagAttrs["obj#"+a],null==c&&(c=gTagAttrs[a]),0==a.indexOf("obj#")&&(a=a.substring(4)),null!=c&&(d=' c.length||0!=c.length%2)return _QTComplain(a,gArgCountErr),"";gTagAttrs=[];gTagAttrs.src=c[0];gTagAttrs.width=c[1];gTagAttrs.height=c[2];gTagAttrs.classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";gTagAttrs.pluginspage="http://www.apple.com/quicktime/download/";a=c[3];if(null==a||""==a)a="6,0,2,0";gTagAttrs.codebase="http://www.apple.com/qtactivex/qtplugin.cab#version="+a;for(var d,e=4;e\n"+_QTAddObjectParam("src",b);e=" \n "}function QT_GenerateOBJECTText(){return _QTGenerate("QT_GenerateOBJECTText",!1,arguments)};
(function(){function e(a){a=a||location.href;return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var k=document,b,f=$.event.special,p=k.documentMode,m="oniLightBoxHashChange"in window&&(void 0===p||7
').hide().one("load",function(){d||n(e());a()}).attr("src",d||
"javascript:0").insertAfter("body")[0].contentWindow,k.onpropertychange=function(){try{"title"===event.propertyName&&(c.document.title=k.title)}catch(a){}})};h.stop=b;f=function(){return e(c.location.href)};n=function(a,d){var b=c.document,e=$.fn.iLightBoxHashChange.domain;a!==d&&(b.title=k.title,b.open(),e&&b.write('